I want to create button with PowerShell command " Set-MpPreference -DisableRealtimeMonitoring 1".
i can't figure it out how to do this correctly.
Mayby it is possible to create button why toggle this two commands:
Set-MpPreference -DisableRealtimeMonitoring 1
and
Set-MpPreference -DisableRealtimeMonitoring 0
Yes you can do it like Leo suggested.
Consider to add following switch if you want to run the command, regardless of what the current powershell execution policy is set to on the computer. "-executionpolicy bypass"
You can run multiple commands as well, they need to be separated by ";".