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!