Can I vbscript a system shutdown/restart? 
Author Message
 Can I vbscript a system shutdown/restart?

I want to create a VBScript or vb app to automatically shutdown and restart
my computer.  I want to run this script or app at midnight everyweek (that I
can use the scheduler for).  But my problem is I am running Windows 98.  I
found an API call "InitiateSystemShutdown" but that only works for NT and
2000.  I tried "ExitWindows" but that requires a user action for the logon
screen.  This needs to be completely without user interaction.

If anyone can help I would greatly appreciate it.

Thank you,
wolfman



Tue, 17 Dec 2002 03:00:00 GMT  
 Can I vbscript a system shutdown/restart?
I have VBScript shutdown and restart scripts for win98 that I use.  They
can be run from the scheduler.  Copy this as shutdown.vbs:

'--------------------------------------------------
' Shutdown script
'--------------------------------------------------
set WshShell = CreateObject("WScript.Shell")

WshShell.run "C:\WINDOWS\RUNDLL.EXE user.exe,exitwindows", 0, false

WScript.quit

For restart replace exitwindows with exitwindowsexec.

Quote:

> I want to create a vbscript or vb app to automatically shutdown and restart
> my computer.  I want to run this script or app at midnight everyweek (that I
> can use the scheduler for).  But my problem is I am running Windows 98.  I
> found an API call "InitiateSystemShutdown" but that only works for NT and
> 2000.  I tried "ExitWindows" but that requires a user action for the logon
> screen.  This needs to be completely without user interaction.

> If anyone can help I would greatly appreciate it.

> Thank you,
> wolfman



Tue, 17 Dec 2002 03:00:00 GMT  
 Can I vbscript a system shutdown/restart?
Shutdown:

    set ws = WScript.CreateObject("WScript.shell")
    ws.run "rundll32 shell32.dll,SHExitWindowsEx 1"

Reboot:

    set ws = WScript.CreateObject("WScript.shell")
    ws.run "rundll32 shell32.dll,SHExitWindowsEx 2"

Logoff User:

    set ws = WScript.CreateObject("WScript.shell")
    ws.run "rundll32 shell32.dll,SHExitWindowsEx 0"

--

Bill James
Microsoft MVPDTS

?Free Win9x VBScript Utilities?
??New Address - Change your links!??
http://www.svvi.net/wgjames/vbspage/

Quote:

> I want to create a vbscript or vb app to automatically shutdown and restart
> my computer.  I want to run this script or app at midnight everyweek (that I
> can use the scheduler for).  But my problem is I am running Windows 98.  I
> found an API call "InitiateSystemShutdown" but that only works for NT and
> 2000.  I tried "ExitWindows" but that requires a user action for the logon
> screen.  This needs to be completely without user interaction.

> If anyone can help I would greatly appreciate it.

> Thank you,
> wolfman



Tue, 17 Dec 2002 03:00:00 GMT  
 Can I vbscript a system shutdown/restart?
Thank you very much!!!

wolfman


Quote:
> I have VBScript shutdown and restart scripts for win98 that I use.  They
> can be run from the scheduler.  Copy this as shutdown.vbs:

> '--------------------------------------------------
> ' Shutdown script
> '--------------------------------------------------
> set WshShell = CreateObject("WScript.Shell")

> WshShell.run "C:\WINDOWS\RUNDLL.EXE user.exe,exitwindows", 0, false

> WScript.quit

> For restart replace exitwindows with exitwindowsexec.


> > I want to create a vbscript or vb app to automatically shutdown and
restart
> > my computer.  I want to run this script or app at midnight everyweek
(that I
> > can use the scheduler for).  But my problem is I am running Windows 98.
I
> > found an API call "InitiateSystemShutdown" but that only works for NT
and
> > 2000.  I tried "ExitWindows" but that requires a user action for the
logon
> > screen.  This needs to be completely without user interaction.

> > If anyone can help I would greatly appreciate it.

> > Thank you,
> > wolfman



Wed, 18 Dec 2002 03:00:00 GMT  
 Can I vbscript a system shutdown/restart?
Thank you very much!!!

wolfman


Shutdown:

    set ws = WScript.CreateObject("WScript.shell")
    ws.run "rundll32 shell32.dll,SHExitWindowsEx 1"

Reboot:

    set ws = WScript.CreateObject("WScript.shell")
    ws.run "rundll32 shell32.dll,SHExitWindowsEx 2"

Logoff User:

    set ws = WScript.CreateObject("WScript.shell")
    ws.run "rundll32 shell32.dll,SHExitWindowsEx 0"

--

Bill James
Microsoft MVPDTS

?Free Win9x VBScript Utilities?
??New Address - Change your links!??
http://www.svvi.net/wgjames/vbspage/


Quote:
> I want to create a vbscript or vb app to automatically shutdown and
restart
> my computer.  I want to run this script or app at midnight everyweek (that
I
> can use the scheduler for).  But my problem is I am running Windows 98.  I
> found an API call "InitiateSystemShutdown" but that only works for NT and
> 2000.  I tried "ExitWindows" but that requires a user action for the logon
> screen.  This needs to be completely without user interaction.

> If anyone can help I would greatly appreciate it.

> Thank you,
> wolfman



Wed, 18 Dec 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to run defrag at system shutdown through vbscript on windows2000

2. Shutdown and restart windows

3. Restart/Shutdown Script

4. Shutdown and Restart

5. Shutdown and Restart Windows 95 and NT for VB Script

6. Windows 2000 Pro - Shutdown/Restart PC

7. Shutdown and Restart

8. System shutdown

9. Off-Topic: Outlook Express causes system shutdown hang

10. shutdown system on weekend

11. shutdown/restart windows

12. Can anybody send VB.net Code to shutdown or restart local computer for me

 

 
Powered by phpBB® Forum Software