by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 4th May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
WMI sample: reboot a (remote) computer. Written in VBScript. Uses Win32_OperatingSystem WMI class.
' 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" )
No comments have been posted about WMI sample: reboot a (remote) computer. Written in VBScript. Uses Win32_OperatingSystem WMI class.. Why not be the first to post a comment about WMI sample: reboot a (remote) computer. Written in VBScript. Uses Win32_OperatingSystem WMI class..