How to reboot or shutdown Windows Server automatically

Sometime, after installing Windows updates, it is necessary to reboot the Windows server.

I have PsTools on OS root drive (c:/PsTools/) of all the servers and to reboot I use “psshutdown.exe” file.

So here is how I schedule automatic reboot on my Windows server.

  1. Login with Administrator privileges user account
  2. Open Command prompt (Start –> Run –> cmd) and enter the following command

[note_box]c:> at 4:00am c:PsToolspsshutdown.exe -r -f[/note_box]

Above give command will create a system scheduled task for Reboot. (Without any reason code to show in Event Viewer)

  • Task will run at 4:00 AM local server time
  • -r for Restart (Replace -r with -s for Shutdown)
  • -f Force close all open applications

As an alternative you can also utilize the windows inbuilt shutdown command as follows

[note_box]c:windowssystem32shutdown.exe -r -t [time-to-reboot-in-seconds] -f -m %computername% -d P:0:0 -c “Planned system reboot”[/note_box]

Enjoy!! :)