In Windows systems, you can use the Task Scheduler to set up regular restarts or shutdowns for your server. This guide will illustrate how to schedule a weekly restart every Saturday at 8 PM. Here are the detailed steps:
Method 1: Using Task Scheduler for Automatic Restart
-
Open Task Scheduler
PressWin + S
, typeTask Scheduler
, and hit Enter to open it. -
Create a Basic Task
- Click on “Create Task” in the right-hand actions panel.
- In the pop-up window, enter a task name (e.g., “Weekly Restart”) and a description (optional).
-
Configure Triggers
- Navigate to the “Triggers” tab.
- Click on “New”.
- In the “Begin the task” dropdown, select “On a schedule”.
- Set it to “Weekly”, choose Saturday, and specify the time as 20:00.
-
Configure Actions
- Switch to the “Actions” tab.
- Click on “New”.
- In the “Action” dropdown, select “Start a program”.
- In the “Program/script” field, enter:
1
shutdown
- In the “Add arguments” field, enter:
Explanation:
1
/r /f /t 0
/r
: Restarts the computer/f
: Forces all applications to close/t 0
: Waits 0 seconds before restarting immediately
-
Configure Additional Task Properties
- Go to the “Conditions” tab and uncheck “Start the task only if the computer is on AC power”.
- Switch to the “Settings” tab and make sure to check “If the task fails, restart every”.
-
Save the Task
Click OK to save the task. You may need to enter the username and password for an administrator account.
Method 2: Using PowerShell Script
If you prefer to use a script, you can create a scheduled task with PowerShell. Below is a sample script to set up a restart every Saturday at 8 PM:
|
|
Save this script as a .ps1
file and run it to schedule the task.
Verify the Task
- In Task Scheduler, find the task you created under “Task Scheduler Library”.
- Right-click the task and select “Run” to ensure it executes properly.
After completing these configurations, the Windows Server will automatically restart every Saturday at 8 PM.