How to Watching for System Shutdown
Keywords: IntControl 1005
NOTICE:
IntControl 1005 was removed from documentation as it did not work as people wished. It worked on on Windows 95/98/ME machines, but was not at all satifactory on NT/2000/XP/2003 machines.
WORKAROUND:
This is a possible workaround for IntControl 1005 on NT platforms. The idea is to Launch a WinBatch service (.exs) and have it monitor for the Shutdown/Logoff message, execute any shutdown/logoff code then exit! You can install the service on the fly using wntSvcCreate then start it using wntSvcStart.
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Functions+IntControl~1005.txt
NT-Shutdown Question:
Can Winbatch detect a NT or Win95 system shutdown? I need to interrupt the shutdown, perform a
series of steps and then allow the shutdown to continue.
I wrote a script wich closes all running services before shutdown.
Does anybody know where I can find the key
to run programs before shutting down ?
Answer:
- The current versions (starting in WinBatch version 97A) can do this.
Look at IntControl 1005 in the help file.
- I don't know of any "pre=shutdown" key.
Ummm... WinBatch IntControl 1005 will give you a SHORT (15
seconds?) amount of time to do shutdown processing.
IntControl 1005 is designed to watch for shutdown state, and then run the current WB script in the 20 seconds preceding shutdown. It will launch when you hit
either Restart or Log off the current user. It's not designed to resume the WB script after startup.
- Although WB can make attempts to prevent WB from being shutdown, we have no ironclad method with which to do that. IntControl(12,8,0,0,0) should
prevent the CTRL-Break termination of the script, but it can't prevent someone from killing the script with Ctrl-Alt-Delete.
- Best way to ensure enough time for stopping processes before shutting down system is
to control the shutdown process in it's entirety.
We set a system policy to disable the shutdown command and then replace this with an
icon/WinBatch compiled script called shutdwn (copied into Windows directory) that
does a nice orderly shutdown of services and then uses INT 66,67 and 68 (restart,
shutdown and relogin, not necessarily in that order) presented in a dialog box for the
users depending on which condition they want.
Code from one of our users is available in the Article #W13315.
Article ID: W13323
Filename: Watch for Shutdown and Perform a Series of Things.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38