How to make Windows shutdown script run earlier

windows-server-2003

At which time in the shutdown sequence does a shutdown script added in the Group Policy Editor in W2k3 run?

I have a couple of 3rd Party applications which run at startup but which always produce General Exceptions during shutdown. I have made a .BAT file with a couple of TASKKILL /F /IM lines which does successfully shut down these apps without an exception when I run it directly.

But I still get the exceptions when shutting down the machine. Later in the shutdown sequence the on-screen message says "running shutdown scripts". Ideally I'd like my .BAT to run first before the rest of the shutdown process. Otherwise someone always needs to be physically at the server to dismiss the Application Error dialogs.

Best Answer

How are you shutting down the machine? You could write a "shutdown.bat" script that calls your taskkill functions and then executes a shutdown command to actually shut down the machine. Then use that script instead of the shutdown button when shutting down the machine.