Create your own shutdown script - called Myshutdown.bat - and do whatever you were going to do in your script and then at the end of it call shutdown /a. Then execute your bat file instead of the normal shutdown.
(See http://www.w7forums.com/threads/run-batch-file-on-shutdown.11860/ for more info.)