Skip to main content

Reboot - Schedule on Specific Days

Summary

This script schedules a reboot for the next applicable day at the specified time on a target machine. For Hyper-V hosts, the script will also create a ticket indicating that the reboot has been scheduled.

Time Saved by Automation: 10 Minutes

Sample Run

Sample Run

Dependencies

None

Variables

@psout@ - Contains the results from the PowerShell script run in line 5.

Global Parameters

NameExampleRequiredDescription
DAYS_TO_REBOOT"Tuesday","Wednesday"TrueMust be a comma-separated list of strings in double quotes with the names of the days of the week to reboot.
HOUR_TO_REBOOT13TrueThe hour of the day to reboot in a 24-hour format. (13 = 1:00 PM, etc.)
MINUTE_TO_REBOOT15TrueThe minute of the hour to reboot. Supports values from 0 - 59
MAINTENANCE_TIME15TrueThe time in minutes for the maintenance window to last.
MAINTENANCE_COMMENTScheduled RebootTrueThe comment to add into the maintenance window.
TicketCreationCategory100TrueThe ticket category to route this ticket to the appropriate board and priority. (For Hyper-V Hosts only)

Process

This script schedules a reboot for the next applicable day at the specified time on a target machine. Once the reboot is scheduled, the maintenance window is set for the reboot time, and the length is determined by a global variable. If the target machine is a Hyper-V server, a maintenance window will also be set for all discovered child machines. A ticket is then generated to make the support team aware of the reboot.

To cancel the reboot after it is scheduled, type "shutdown /a" in a command prompt window. This will abort the scheduled restart.

Output

  • Script log messages
  • Ticket (For Hyper-V hosts only)