Force Restart or launch external application
from
WinCustomize Forums
I need to know how to do a system restart, or at least, launch an external program.
| Public Sub ServerReboot(strServer) On Error Resume Next Set objWMIService = GetObject("winmgmts: {impersonationLevel=impersonate,(Shutdown)}!\\" & strServer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown (6)'(6) is a forced reboot Next Set objWMIService = nothing Set colOperatingSystems = nothing End Sub |
Welcome Guest! Please take the time to register with us.