Shutdown script

  • Thread starter Thread starter Stephen Ford
  • Start date Start date
S

Stephen Ford

Is there a script that runs on shutdown to enable intervention prior to
shutdown commencing?
 
From: "Stephen Ford" <stephen_ford_NO_@_SPAM_uwclub.net>

| Is there a script that runs on shutdown to enable intervention prior to
| shutdown commencing?
|

WinXP Home or Professional ?

If it is Professional...

Execute; GPEDIT.MSC

Go to...
Computer configuration --> windows settings --> scripts (startup/shutdown)
Choose; Shutdown

Add your script.
 
Hi Stephen,

You can use a batch file to shutdown your PC and put your shutdown
tasks before the final line that says shutdown /s /t 0
Of course this relies on the user clicking on (running) this batch
file rather than just a menu start / shutdown mouse or keyboard
sequence.

The batch file would look like:

call dostuff.bat
shutdown /s /t 0


The problem with a dedicated program or service that watches for
shutdown is that the machine IS shutting down! So you can't do
anything reliably - you may get away with doing some task if its quick
- but only some of the time - without certainty.

Here is a VBScript that I use on some client desktops - I tell them to
"run this icon" to shut down.

Option Explicit
Dim Res, strCmd, ExitCode, WshShell
Const EVENT_SUCCESS = 0

Res = MsgBox("Are you sure?", vbYesNo, "Shutdown Computer")

If Res <> vbYes then
Wscript.Quit
End If

strCmd = "shutdown /s /t 0"


Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.LogEvent EVENT_SUCCESS, "Normal user shutdown command at -
" & Now()
ExitCode = WshShell.Run(strCmd, 10, TRUE )
Set WshShell = Nothing



Hope that helps.
CreateWindow
http://mymessagetaker.com
The while-you-were-out message program you have been looking for!
 
From: <[email protected]>

< snip >

|
| Option Explicit
| Dim Res, strCmd, ExitCode, WshShell
| Const EVENT_SUCCESS = 0
|
| Res = MsgBox("Are you sure?", vbYesNo, "Shutdown Computer")
|
| If Res <> vbYes then
| Wscript.Quit
| End If
|
| strCmd = "shutdown /s /t 0"
|
| Set WshShell = WScript.CreateObject("WScript.Shell")
| WshShell.LogEvent EVENT_SUCCESS, "Normal user shutdown command at -
| " & Now()
| ExitCode = WshShell.Run(strCmd, 10, TRUE )
| Set WshShell = Nothing
|

That's funny. You have to do all that in VBS.

All you have to do in KiXtart is...

ShutDown ("computer", "message", wait, force, options)

He, he...
 
Dave,

KiXtart looks way cool & where have I been to have missed it? Since
1991 too I note!
Just shows I don't know everything after all :-)

CareWare too - neat....


CreateWindow(LPCTSTR lpClassName........ etc. The WinAPI can bw worse
then VBScript!
 
From: <[email protected]>

| Dave,
|
| KiXtart looks way cool & where have I been to have missed it? Since
| 1991 too I note!
| Just shows I don't know everything after all :-)
|
| CareWare too - neat....
|
| CreateWindow(LPCTSTR lpClassName........ etc. The WinAPI can bw worse
| then VBScript!

I wrote my Multi AV Scanning Tool entirely in KiXtart

Download MULTI_AV.EXE from the URL --
http://www.pctipp.ch/ds/28400/28470/Multi_AV.exe

http://www.raymond.cc/blog/archives/2008/01/09/scan-your-computer-with-multiple-anti-virus-for-free/
 
Technet Script Centre has all the free scripts you'll ever need & tools to create others

http://www.microsoft.com/technet/scriptcenter/default.mspx

The only true way is to temporily revoke the Shutdown privilege, do your stuff then
re-enable that privilege as when you start shutdown it will always continue with unloading
the 32/64 bit items & once out of that mode you aren't doing anything these days as such
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top