Go into windows task scheduler.
- Create a basic task.
- Enter a Name and Description, click next
- You should now be in the trigger option. Set the trigger as "When a specific event is logged" and click next.
- In the Log drop down, choose "system"
- In the Source dropdown, select "Kernal-power"
- and in the Event ID, put in "109"
After that, click next for start a program and then load your script in. This should run the script before the shutdown command has been executed. I could be wrong, but these steps should point you in the right direction.
I'm also sure that a quick regedit would be able disable the shutdown button.
edit
Here is that regedit fix that might meet your needs.
http://www.intowindows.com/how-to-remove-shutdown-restart-hibernate-options-from-start-menu-shutdown-dialog-box/