Solved

Execute a batch script before windows 2000 reboot or shutdown

Posted on 2004-09-23
3
435 Views
Last Modified: 2010-04-14
Hello,

I have three services which needs to be stopped in a sequence before rebooting or shutting down the Windows 2000 server. I can use a batch script with net stop command to stop the services in an order. But I am not sure how I can execute this batch file before the OS  reboot or shut down.

Note that i can put a batch script in the windows startup folder to start the services in a sequence (setting the service start type to manual), but there is no provision in Windows 2000 to execute the batch script prior to shut down.

Thanks
0
Comment
Question by:yasmagic
  • 2
3 Comments
 
LVL 3

Expert Comment

by:onesquin
ID: 12134304
This can be done through the local machine policy or through a domain policy if you want it to happen on several servers(or just that one).

GOTO-  Start | Run...  then type gpedit.msc, click OK.

Expand Computer Config | Windows Settings | Scripts  Double Click Shutdown and add your batch file.

On XP and maybe 2003 server you can type from the command line gpupdate and it should update the policy so when you shutdown it will run your script.

hope this helps
0
 

Author Comment

by:yasmagic
ID: 12138799
Thanks for the info. I have added a shutdown batch script to stop the services in a sequence and added that in gpedit.msc (Expand Computer Config | Windows Settings | Scripts  Double Click Shutdown and add your batch file). The problem is that when I reboot the server, I don't see the batch script getting executed. Is this only applicable when we shutdown the server?
0
 
LVL 3

Accepted Solution

by:
onesquin earned 500 total points
ID: 12142214
I think it is ran in the background or when it shows the little box that says saving your settings.

2k and xp never show scripts running like nt4

Try adding a line that outputs to a file  echo It worked!! >> c:\test.txt to see if it ran... maybe add a timestamp too.  date /t >> c:\test.txt

good luck.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Adults who share images on social media aren’t the only ones who need to worry about their privacy. Our culture’s tendency to share every move and celebration affects the privacy of our children, too.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question