SHARE
TWEET

Untitled

a guest Sep 19th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Param(
  2.     $userAccount = "NT AUTHORITY\SYSTEM",
  3.     $exePath = "C:\Code\SampleTaskConsole\bin\Debug\SampleTaskConsole.exe",
  4.     $taskName = "ScormCloudReporting"
  5. )
  6.  
  7. Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
  8.  
  9. $action     = New-ScheduledTaskAction -Execute $exePath
  10. $trigger    = New-ScheduledTaskTrigger -Daily -At 1am
  11. $principal  = New-ScheduledTaskPrincipal -UserID $userAccount -LogonType ServiceAccount -RunLevel Highest
  12.  
  13. Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskName -Description $taskName -Principal $principal
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top