Restart a Windows 2008 R2 server via Task Scheduler

There are many reasons you may need to restart a server via task scheduler.  My favorite reason is so I can reboot the server after patching without having to work late.  🙂

This example will restart a server every morning at 6:00 AM Monday through Friday, but will not restart it on the weekends.

Start / Administrative Tools / Task Scheduler

Right-click Task Scheduler Library (or optional sub folder) and create task.

General Tab
Name: Descriptive name such as: RestartOneTimeMorning0600am or: RestartWeeklySundayMorning0130am
Description: Put in your own description, such as: Scheduled after-hours server restart
When running the task, use the following user account: NT AUTHORITY\SYSTEM
* (Note: Select “SYSTEM” when browsing using “Change User or Group…”)
Check “Run with highest privileges”
Configure for: Windows 7, Windows Server 2008 R2

Server Restart General Tab

Server Restart General Tab

Triggers Tab
New…
Begin the task: On a schedule
Settings: Set your preferences. Be sure to select “Enabled” so it will run.
OK

Server Restart New Trigger

Server Restart New Trigger

Server Restart Triggers Tab

Server Restart Triggers Tab

Actions Tab
New…
Action: Start a Program
Program/script: C:\WINDOWS\system32\shutdown.exe
Add arguments: -r /t 300 /c “This server will restart in 5 minutes. Save and Exit NOW!” /d p:1:1
Start in: c:\windows\system32
Note: /t 300 sets it to restart in 300 seconds, which is 5 minutes. Change the # of seconds to meet your needs, and update the server restart message to reflect the appropriate time.

Server Restart New Action

Server Restart New Action

Server Restart Action Tab

Server Restart Action Tab

 

Leave the rest of the tabs at default.


Leave a Reply

Your email address will not be published. Required fields are marked *