Login | |
|
 |
RE: Failed Shutdown - 9/20/2005 5:44:37 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
You have to capture the cancel button. In your script, you click Cancel and since you don't check for it, it will go on to the next part of the script. Try something like this. ret = WshShell.Popup(strText,IntSecToWait,strTitle,intType) If ret = 2 then '2=cancel button' Taken from WSH Docs. Msgbox " Reboot stopped" End if Do reboot here. As to your shutdown, doing a quick search in Script Center, there seems to be a .Win32ShutDown(1). Try objOperatingSystem.Win32Shutdown(1)
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: Failed Shutdown - 9/20/2005 5:45:56 AM
|
|
 |
|
| |
Snipah
Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
Here's a script that will shutdown and power off (if the computer supports) Win 2000: Const SHUTDOWN = 8 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _ strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("SELECT * FROM Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown(SHUTDOWN) Next Use SHUTDOWN = 1 to shutdown without powering off.
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
|
|