Polls

Topics

Schedule Windows server to reboot or shutdown automatically

Posted by Vivek on Saturday April 22, 06 @5:15 pm

Sometime it is necessary to reboot (or shutdown) windows server. Under UNIX or Linux you can use reboot / hal t/shutdown command via cron jobs or at command. But, when it comes to Windows server there is no built in command exist. Only Windows 2000 Resource Kit offers shutdown command line utility.

However, sysinternals has nifty utility called PsShutdown. It is a command-line utility similar to the shutdown utility from the Windows 2000 Resource Kit, but with the ability to do much more. In addition to supporting the same options for shutting down or rebooting the local or a remote computer, PsShutdown can logoff the console user or lock the console (locking requires Windows 2000 or higher). PsShutdown requires no manual installation of client software.

How do I schedule Windows Server Reboot / Shutdown?

You can download PsShutdown from sysinternals web site.

Store file on Windows server in folder. I use folder called C:\admutils. Next open windows command prompt (Start > Run > cmd) and use windows at command to schedule reboot:
c:> at 2:00am c:\admutils\psshutdown.exe -r -f -c -t 10
Above command will reboot system at 2am. If you want to shutdown system:
c:> at 1:00am c:\admutils\psshutdown.exe -s -f -c -t 10
Where,

For more information read official psshutdown documentation. Read at command help by typing at /? command.

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or full RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in...

Discussion on This Article:

  1. Anonymous Says:

    Excellent information, I thought you guys only likes UNIX / Linux ;)
    Keep it up good work.

  2. Anonymous Says:

    Windows server already includes a shutdown command called just shutdown!

  3. Anonymous Says:

    Ok I will try reading the post next time

  4. TimBee Says:

    You should also add the command “-accepteula” to the psshutdown command, because otherwise the task will hang, idicating a “running” state in Scheduled Tasks. It’s just waiting for the EULA agreement, which it doesn’t show.

    So, to complete the example before, type:

    “at 2:00am c:\admutils\psshutdown.exe -r -f -c -t 10 -accepteula”.

  5. nixcraft Says:

    @TimBee,

    Thanks for pointing out this issue.

    Appreciate your post.

  6. TimBee Says:

    NixCraft -> Thank YOU for this helpful article! :-)

  7. Weenie Says:

    great. I was experiencing problem with shutdown built-in command.
    just discovered this website, looks very interresting.

  8. Dan Says:

    What switch do I need to do a weekly restart?

  9. nixcraft Says:

    Dan,

    Use windows schedule task option and select weekly option.

  10. Mani G Says:

    Nice article.. It has helped me a lot. Thank you.

  11. Les W Says:

    Thank you. A very usful bit of information, just what the doctor ordered.

  12. Jeff Smith Says:

    a’noon everyone.I am running, win server2003. I have tried… the above. and it does nto work for me-I must be doing something wrong. I have typed the following. in the cmd prompt. C:\>at 11:45am c:\pstools\psshutdown.exe -r -f -c -t 10
    I press enter and I get the following message. “Added a new job with job ID = 1″
    NOTHING happens….at the said time…!!!! what am I missing? the official documentation, states that I have to put in the comp name? is this what I am missing???? please help. many thanks, J

  13. Jeff Smith Says:

    PS: how can I view these said jobs as well? I now apparently have 3 jobs pending.thanks. J

  14. Jeff Smith Says:

    There is no need to reponde to my 1st message, I never saw the add -accepteula part. It now seems to work. Blindin, thanks. Can I get some script to make this run daily, without any manual intervention.

  15. vivek Says:

    Use the task scheduler in Windows 2000/2003 server by visiting My Comp > Control Panel > Scheduled Tasks

    HTH

  16. Jeff Smith Says:

    yea thanks-I found that….im just being thick.monday morning hang over :).thanks

  17. cornel panceac Says:

    for the ones who wonder, it looks like ’scheduled tasks’ is just a frontend to at, so if you wanna schedule some tasks, you can also use at /? to find out how :)
    of course you’ll find out that entering just
    at
    will display the current jobs
    at /delete
    will delete the thing and so forth :)
    happy hacking 2 all :)

  18. cornel panceac Says:

    testing today the command, i’ve found that -accepteula is not a supported parameter on recent version of psshutdown, as jeff smith pointed earlier

  19. Rod Says:

    Works great with -accepteula, thanks

  20. Andy Duncan Says:

    I tried it with the accepteula switch and it still did not work……………….I am using windows 2003 server and R2

  21. Andy duncan Says:

    My mistake i had to update to the latest version of the tool once i did that the -accepteula worked fine

  22. Joe H Says:

    You can also do this through Scheduled Tasks. Go to Control Panel->Scheduled Tasks->Add Task. Select Browse and go to %Windows%\System32\ and select shutdown.exe. You can then follow the wizard to select how often and at what time. You’ll need to provide account login info that has admin privileges on the machine. At end select the option to display advanced properties. Under the Task pane you’ll see it is going to run C:\WINDOWS\system32\shutdown.exe. You can add the /r option to restart - or any other you may need such as /t 60 to wait 60 seconds before restarting.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , ~ Last updated on: September 13, 2007

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.