$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'
|