Link to home
Start Free TrialLog in
Avatar of yasmagic
yasmagic

asked on

Execute a batch script before windows 2000 reboot or shutdown

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
Avatar of onesquin
onesquin

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
Avatar of yasmagic

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of onesquin
onesquin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial