User Tools

Site Tools


computing:windows:reboot

Shut Down or Reboot a Windows Server

From Linux

:!: Use a username with admin privileges.

:!: You will need the samba-common package installed for Ubuntu.

  • sudo apt-get install samba-common
net rpc shutdown -r -f -I xxx.xxx.xxx.xxx -U username

Do It Now

Reboot the local machine now:

shutdown -r -t 0

Shutdown now showing a dialog box with a timer (in seconds):

shutdown -s -t 60

With a timer and a message:

shutdown -s -t 120 -c "Please save your work immediately because the server is being rebooted!"

Shutdown another computer in your domain:

shutdown -s -m \\computername -t 10

Cancel a shutdown:

shutdown -a

Do It Later

Using the 'at' Command

Download and extract the PsTools package from SysInternals (now Microsoft). We extract the zip archive into C:\Support\PsTools\ as a convention.

Use the 'at' command to schedule a one-off reboot:

at 2:00am c:\support\pstools\psshutdown.exe -r -f -c -t 10

or shutdown:

at 2:00am c:\support\pstools\psshutdown.exe -s -f -c -t 10

Where:

-s: Shutdown windows server
-r: Reboot windows server
-f: Forces all running application to exit
-c: Allow the shutdown to be canceled user
-t: Specifies the countdown in seconds until the shutdown

Using the Task Scheduler

Windows 2003/2008

Windows 2008 R2

http://www.wegotserved.com/2011/11/04/set-automatic-scheduled-reboots-windows-home-server-2011/

Task Scheduler → Action → Create Task → General

  1. Name the task Scheduled Reboot
  2. Use the SYSTEM user account
  3. Select Run with highest privileges
  4. Configure for Windows 2008 R2

Task Scheduler → Action → Create Task → Triggers

  1. On a schedule
  2. One time

:!: We add two actions, one to warn users and the other to reboot the server.

Task Scheduler → Action → Create Task → Actions

  1. Set the Action to Start a program
  2. Set the Program to C:\Windows\System32\msg.exe
  3. Set the Arguments to * “Please log out now. This server is rebooting in 5 minutes!”

Task Scheduler → Action → Create Task → Actions

  1. Set the Action to Start a program
  2. Set the Program to C:\Windows\System32\shutdown.exe
  3. Set the Arguments to /r /f /t 300 /c “Scheduled Reboot” /d p:4:1
  4. Set Start in to c:\windows\system32
  5. Set the Comments to Reboot in 5 minutes with reason as 'Application: Maintenance (Planned)'

Windows 2012 R2

Task Scheduler → Action → Create Task → General

  1. Name the task Scheduled Reboot
  2. Use the SYSTEM user account
  3. Select Run with highest privileges
  4. Configure for Windows 2012 R2

Task Scheduler → Action → Create Task → Triggers

  1. New
  2. On a schedule
  3. One time
  4. Set the date and time of the desired reboot
  5. Stop task if it runs longer than 30 minutes
  6. OK

:!: We add two actions, one to warn users and the other to reboot the server.

Task Scheduler → Action → Create Task → Actions

  1. New
  2. Set the Action to Start a program
  3. Set the Program to C:\Windows\System32\msg.exe
  4. Set the Arguments to * “Please log out now. This server is rebooting in 5 minutes!”
  5. OK

Task Scheduler → Action → Create Task → Actions

  1. New
  2. Set the Action to Start a program
  3. Set the Program to C:\Windows\System32\shutdown.exe
  4. Set the Arguments to /r /f /t 300 /c “Scheduled Reboot” /d p:4:1
  5. Set Start in to c:\windows\system32
  6. OK

:!: You can easily export saved tasks to be imported to other machines.

computing/windows/reboot.txt · Last modified: 2017/05/06 12:00 by gcooper