Force Restart or launch external application

I need to know how to do a system restart, or at least, launch an external program.
1,638 views 3 replies
Reply #1 Top
No promises but to reboot via script . . .:
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



Another option is to create a batch file that has the text shutdown.exe -f -r

Posted via WinCustomize Browser/Stardock Central
Reply #2 Top
Thanks. I'm really new to this. I know a lot of VBScript, but the system hooks are foreign to me. How do I launch a bat file from within my script?
Reply #3 Top
Okay, I figured out how to launch a program. Now I'm getting "A required privilege is not held by the client."