Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been looking for a way to run a batch script(just a single 'del' command) whenever the system shutdowns or reboots. The system is running a Windows XP Professional with Service Pack 2.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

You can define a shutdown script from within the group policy editor (Local Computer Policy -> Computer Configuration -> Windows Settings -> Scripts).

share|improve this answer
    
+1. I use the startup/shutdown script on all servers (via GPO) to have an email sent when a machine is shutting down, and has then booted back up, on top of monitoring, just in case the reboot is too quick for Nagios to catch it. Handy. (Although I'd love it if it didn't matter which servers were shut down :) –  Andrew H Jul 18 '09 at 8:28

You can use scheduled tasks to run a command at system start or user log on. http://support.microsoft.com/kb/308569

share|improve this answer
    
Does not cover shutdown/logoff. –  Richard Jul 18 '09 at 9:04
    
But can be combined with the other approach. –  Joey Jul 18 '09 at 13:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.