Solved

Execute a batch script before windows 2000 reboot or shutdown

Posted on 2004-09-23
3
429 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now