Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Execute a batch script before windows 2000 reboot or shutdown

Posted on 2004-09-23
3
Medium Priority
?
442 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part III
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

647 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