Scheduling a WS03 box to restart is very simple, I’ve done it more times than I can recall.
To get a WS08 box to restart using Powershell requires a few things.
1. The execution policy needs to be set to allow scripts to run.
2. The script needs to be written.
3. The task needs to be scheduled.
The server’s execution policy should be set to RemoteSigned, if it isn’t already.
The Powershell command to reboot a computer is Restart-Computer.
Open Notepad, type
Restart-Computer and save the file as with the extension of PS1.
Scheduling the task is a bit trickier, unlike a batch file the scheduler won’t run a PS1 script automatically.
When setting up the scheduled task, on the “Start a Program” screen, put “Powershell.exe” in the Program/Script box and in the Arguments box put “-NoLogo -File C:PathtoScript.ps1” (don’t forget to put quotes around the file path if there are any space).
Note: What happens if you put your script in the Program/Script box? The script opens in Notepad.