HOW DO I SHUTDOWN 
Author Message
 HOW DO I SHUTDOWN

HOW DO I SHUTDOWN USING A VBS ?

tealth D



Sat, 03 May 2003 03:00:00 GMT  
 HOW DO I SHUTDOWN


Quote:


> > HOW DO I SHUTDOWN USING A VBS ?

> > tealth D

>   Run your script and press the power button on the front of your
> computer.

... trouble is, I think it is *your* computer he wants to shutdown ...

/Al



Sat, 03 May 2003 03:00:00 GMT  
 HOW DO I SHUTDOWN

Quote:

> HOW DO I SHUTDOWN USING A VBS ?

> tealth D

  Run your script and press the power button on the front of your
computer.


Sun, 04 May 2003 11:28:48 GMT  
 HOW DO I SHUTDOWN
In that case he would add the following line of code to his script
  msgbox "Please press the power button on your computer"
Quote:




> > > HOW DO I SHUTDOWN USING A VBS ?

> > > tealth D

> >   Run your script and press the power button on the front of your
> > computer.

> ... trouble is, I think it is *your* computer he wants to shutdown ...

> /Al



Sun, 04 May 2003 03:00:00 GMT  
 HOW DO I SHUTDOWN
WMI required...

'Win32_OperatingSystem
'http://msdn.microsoft.com/library/psdk/wmisdk/clasops_0h7x.htm

Set wmi = GetObject("winmgmts:{(Shutdown)}")
set objset = wmi.instancesof("win32_operatingsystem")
for each obj in objset
  set os = obj :  exit for
next

'====
' take your pick...
'====
'
'os.shutdown
'os.reboot

Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
'
'os.win32shutdown iFlags

The WMI docs for Win32Shutdown are contradictory.  In some places they the valid values for iFlags
are:

Flag Value
0 Shutdown
1 Reboot
2 Force
3 Power Off

And in other places they say to use the EWX_XXXXXX constants.  IIRC, the one and only time I
experimented with Win32Shutdown, the EWX_XXXXXX constants are what worked...

--

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> HOW DO I SHUTDOWN USING A VBS ?

> tealth D



Sun, 04 May 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Automatic Shutdown of Application when Windows is shutdown

2. Automatic shutdown of application when windows is shutdown

3. Automatic shutdown of application when windows is shutdown

4. Automatic shutdown of application when windows is shutdown

5. Automatic shutdown of application when windows is shutdown

6. Automatic shutdown of application when windows is shutdown

7. ADO thinks DBMS is done, but DBMS ain't done

8. How to Shutdown or LognOff or Restart with shutdown.exe on time in windowsXP?

9. Rerun a program automatically in wsh if it dies or is shutdown

10. How can I detect Browser shutdown?

11. Shutdown browser

12. How to shutdown windows from a web page

 

 
Powered by phpBB® Forum Software