Batch file to restart server 2003

Net_Admin1
Net_Admin1 used Ask the Experts™
on
Hello experts,

I need to create a batch file to re-start my windows server 2003 automatically twice a day.
The idea is to create the batch file then schedule the task.

Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Microsoft Network Administrator
Commented:
I would recommend using the shutdown command in your batch file

Something like:


shutdown -r -t 05

Would shutdown and restart the computer after a 5 second delay.

You can read more about the shutdown command options by typing "shutdown /?" at the command prompt.

Hope this helps!

:o)

Bartender_1

Author

Commented:
my batch file looks like this right now but it won't run:

shutdown -r

is there something that I am missing?
Top Expert 2012
Commented:
shutdown -f -r -t 05

Use the -f switch this will force shutdown of any applications that are currently running so it will shutdown right then not wait on applications to shutdown first. If you don't use -f you can potentially have a hung server as well.
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Author

Commented:
what else needs to be in the batch file?
Bartender_1Microsoft Network Administrator

Commented:
using the -f parameter will force the shutdown, however, it will force any applications that are running to close, regardless of whether or not it will cause data loss. So I would recommend carefully weighing whether or not this is acceptable for your situation.

:o)

Bartender_1

Author

Commented:
is this the actual batch fille?

@echo off
shutodown -r
Bartender_1Microsoft Network Administrator

Commented:
the actual batch file should contain:

@echo off
shutdown -f -r
Bartender_1Microsoft Network Administrator

Commented:
Assuming of course, that you want to force the shutdown.

Author

Commented:
none

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial