This is all that I have got.
$action = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument '-NoProfile -WindowStyle Hidden -command "& {Restart-Computer -Force -wait}"' $trigger = New-ScheduledTaskTrigger -Once -At 3am Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'ScheduledReboot'
But this works once, then there is a task called “scheduledReboot” that won’t clear out. Is there a way to make this repeatable?
submitted by /u/trogdor3000
[link] [comments]
The post How to schedule a one-time reboot via PS oneliner/function? appeared first on How to Code .NET.