WMI sample: reboot a (remote) computer. Written in VBScript. Uses Win32_OperatingSystem WMI class.
WMI sample: reboot a (remote) computer. Written in VBScript. Uses Win32_OperatingSystem WMI class.
Rate WMI sample: reboot a (remote) computer. Written in VBScript. Uses Win32_OperatingSystem WMI class.
(3(3 Vote))
' This function reboots a (remote) computer
' Check out http://www.activexperts.com for more samples and components
Sub RebootComputer( strServer )
Set objOSSet = GetObject("winmgmts:{(RemoteShutdown)}//" & strServer & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
For each objOS in objOSSet
objOS.Reboot()
Next
End Sub
' Main
Dim strComputer
Do
strComputer = inputbox( "Please enter the name of the computer you want to reboot", "Input" )
Loop until strComputer <> ""
RebootComputer( strComputer )
WScript.Echo( "Computer " & strComputer & " rebooted" )
WScript.Echo( "Check out http://www.activexperts.com for more samples and components" )
WMI sample: reboot a (remote) computer. Written in VBScript. Uses Win32_OperatingSystem WMI class. Comments
No comments yet — be the first to post one!
Post a Comment