After digging around for a sample VBScript to reboot a computer, I located the following that I thought would be useful.
' to invoke reboot, add the following line and sub routine to your VBScript
Reboot
Sub Reboot()
dim strComputer, objWMIService, colOS, objOS
strComputer = "." ' Local Computer
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOS in colOS
objOS.Reboot()
Next
End Sub
In PowerShell we would use the following, assuming you are logged on with administrator rights.
- local computer reboot
$objServerOS = gwmi win32_operatingsystem
$objServerOS.reboot()
- remote computer reboot
$objServerOS = gwmi win32_operatingsystem -computer servername
$objServerOS.reboot()