Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SCRIPT to reboot WINDOWS 2008 server with scheduled task

Posted on 2009-12-20
9
Medium Priority
?
21,847 Views
Last Modified: 2012-06-18
Hello,

I need a script to reboot windows 2008 server with scheduled task.

Thanks
0
Comment
Question by:cawasaki
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 10

Expert Comment

by:lof
ID: 26092291
you may reboot you server with a command

shutdown -r

you may schedule such task
0
 
LVL 2

Expert Comment

by:nergik
ID: 26092625
Do you just want to reboot the server at a specified hour ?  or do you need to check if some process are running and wait for them to rebook?

Btw, why do you need to do that? if you can explain us a little bit more the problem maybe theres a better solution for it
0
 
LVL 21

Accepted Solution

by:
farazhkhan earned 1000 total points
ID: 26094069
Hi,

There is a command line tool that comes with Windows Server 2008 -- so you don't need any 3rd party or resource kit tools.

You can simply put something like this into batch file:

shutdown -r -t 60

-r is for reboot
-t is in how many seconds (60 seconds)

Name the batch file something like "reboot.bat". Now set up schedule just like you would for any other task and call that batch file at convenient time.

Regards,
Faraz H. Khan
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Assisted Solution

by:malcou
malcou earned 1000 total points
ID: 26094555
I agree with lof and farazhkhan use shutdown comand - but I would add the -f parameter which forces shutdown even if there is a popup box on the screen waiting for an answer.
If you want to run this from another computer you could create a bat file with the following line and schedule it from there

shutdown -r -f -t 60 -m \\windows2008server

The Task Scheduler in 2008 can be found under Administrative Tools

0
 

Author Comment

by:cawasaki
ID: 26098615
hi,

i need this because the admin of server has not  access to this server (no TSE access...), he has just right to open scheduled task mmc from remote server.

shutdown -r -f -t 60 -m \\windows2008server

==> 1-this command reboot the server properly?
2- can I execute this command from remote server on cmd prompt?

Thanks for your help
0
 
LVL 2

Expert Comment

by:nergik
ID: 26101164
hello,
but the remote admin doesnt have acces to the server because you set up explicit rules acessing it or becauae there's connectivity problems/firewalls,etc? if this is the case i will suggest installing a simple remoting app like teamviewer.com on the host, and then the remote user would be able to easily connect and reboot the server on demand with a single click
0
 
LVL 2

Expert Comment

by:malcou
ID: 26102781
You can execute this command on a remote server if the user you execute it with has local administrator rights on the server, or at least the rights to shutdown the server.
You can check this in the local security policy under Administritive tools. Check under Local Policy/User Rights assignment/Shut down the system
If this is not possible you must run it on the local machine with a local administrator
0
 

Author Comment

by:cawasaki
ID: 26103057
Hi,

Yes the user is a local administrator of server.

I have setup a gpo to block tse session on server!

Ok, i try to execute this command from remote server:

shutdown -r -f -t 60 -m \\windows2008server

Thanks
0
 
LVL 10

Expert Comment

by:lof
ID: 26142755
Was the problem resolved or do you still need help on that one?
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

564 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