Listing 4: RebootSubnet.vbs strIPSubnet = «192.168.0.» Set objShell = CreateObject(«WScript.Shell») On Error Resume Next For strIPNode = 1 To 254 strComputer = strIPSubnet & strIPNode Set objScriptExec = objShell.Exec(«ping -n 2 -w 1000 « & strComputer) strPingStdOut = LCase(objScriptExec.StdOut.ReadAll) If InStr(strPingStdOut, «reply from « & strComputer) Then Set objWMIService = GetObject(«winmgmts:» & _ «{impersonationLevel=impersonate,(Shutdown)}!» & _ strComputer & « ootcimv2») If Err.Number <> 0 Then WScript.Echo strComputer & «: « & Err.Description Err.Clear Else Set colOperatingSystems = objWMIService.ExecQuery _ («SELECT * FROM Win32_OperatingSystem») For Each objOperatingSystem in colOperatingSystems objOperatingSystem.Reboot() Next End If Else WScript.Echo strComputer & «: Host unreachable» End If Next