How to Reboot remote computers on a domain

Below Step to reboot remote computers
arrComputer = Array("Computer1", "Computer2", "Computer3")
For Each strComputer In arrComputer
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(2)
Next
Next

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.