Submitted By: Steve Forshaw

Schedules an automatic reboot of a computer at a specific day and time.

Visual Basic
Edit|Remove
' Schedule Forced System reboot
' Scheduled for every Sunday at 2:00AM
' To set reboot schedule to Saturday, change value 64 to 32
' To set reboot schedule to every weekday, change value to 31
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
  & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
 Set objNewJob1 = objWMIService.Get("Win32_ScheduledJob")
 errJobCreated = objNewJob1.Create _
     ("shutdown.exe " & " -f -r", "********040000.000000-120", _
        True , 64, , , , JobID)