Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

create scheduled task via powershell scheduled reboot

$action = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument '-NoProfile -WindowStyle Hidden -command "& {Restart-Computer -Force -wait}"'
$trigger = New-ScheduledTaskTrigger -Daily -At 3am
$principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITYSYSTEM" -LogonType ServiceAccount -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -MultipleInstances Parallel
Register-ScheduledTask -TaskName "YourTaskName" -Action $action -Trigger $trigger -Settings $settings -Principal $principal
Source by answers.microsoft.com #
 
PREVIOUS NEXT
Tagged: #create #scheduled #task #powershell #scheduled #reboot
ADD COMMENT
Topic
Name
9+9 =