Force Restart or launch external application

Tuesday, February 14, 2006 by frasej | Discussion: DesktopX

I need to know how to do a system restart, or at least, launch an external program.
ZubaZ
Reply #1 Tuesday, February 14, 2006 3:29 PM
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
frasej
Reply #2 Tuesday, February 14, 2006 3:45 PM
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?
frasej
Reply #3 Tuesday, February 14, 2006 4:41 PM
Okay, I figured out how to launch a program. Now I'm getting "A required privilege is not held by the client."

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01