strComputer = "<computername>"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _ strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _ strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
No comments:
Post a Comment