Created:
4/18/2006 3:46:57 PM

Author:
Przemek Radzikowski

permalink [Permalink]





International Careers & Jobs - An international employment directory, reviewing world-wide top job sites




  • Home  ›
  • Articles  ›
  • Shutdown or Restart Computers Remotely



| More

Shutdown or Restart Computers Remotely

If you’ve ever wanted to schedule your computer to shutdown or restart after a period of time or simply at a specified time of the day you can do this quite easily using the Task Scheduler and the Shutdown.exe command.


 

 

Introduction

Continue with this article if you're after information on using the Task Scheduler to setup shutdown and restart jobs.

If you're after information on how to use Shutdown and CMD you probably want this article: Restart or Shutdown Computers Using CMD and SHUTDOWN Commands from the Command Line

The Real Introduction

There may be instances when you may want to runThe following scenarios will tell you exactly how to use Shutdown.exe to setup your Shutdown and Scheduled Tasks jobs to take care of most of your tasks.

The general syntax for the shutdown.exe command is as follows:

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername]
[-t xx] [-c "comment"] [-d up:xx:yy]
No args Display this message (same as -?)
-i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536)

Use shutdown.exe to shutdown your computer in 30 seconds

  1. Click Start
  2. Click Run
  3. In the Run box, type cmd and click OK
  4. A black box (command shell) shows up and inside it type: shutdown -s -t 30 and hit Enter

Use shutdown.exe to shutdown a remote computer in 1 hour (60 minutes) seconds

If you would like to shutdown a remote computer you can also achieve this using the shutdown command. This command will allow you to use the –m \\computer switch to designate the computer to shutdown.  Rember also that the -t (time) command uses seconds as the unit of time, so all your times will need to be in seconds.  In our example 1 hour (60 minutes) will be 3600 seconds.

In our example, say we would like to shutdown a computer named MyOtherComputer in 60 minutes (3600 seconds):

  1. Click Start
  2. Click Run
  3. In the Run box, type cmd and click OK
  4. A black box (command shell) shows up and inside it type: shutdown -s –m \\MyOtherComputer-t 3600 and hit Enter

Using Sheduled Tasks and Shutdown.exe to automate your Computer

Lets say for a second that you would like to shutdown/reset your/another computer on a regular basis.  For instance, you might have a requirement to configure your computer to shutdown at 3am every night regardless of whether you are there or not.

The easiest way to do this is to setup a Sheduled Task using the Sheduled Tasks utility in Windows. 

To open Scheduled Tasks:

  1. Click on Start
  2. Click All Programs
  3. Click Accessories
  4. Click System Tools
  5. Click Scheduled Tasks

Sheduled Task

To Create a new Scheduled Task:

  1. Double click on the "Add Scheduled Task" icon
  2. In the Scheduled Task Wizard click Next
  3. Click Browse and in the filename box type c:\windows\system32\shutdown.exe and Click OK
  4. Give your task a name, such as Shutdown at 3am
  5. Select Daily and Click Next
  6. Enter the start time to be 3:00 AM and click Next
  7. Enter the username and password which will be used to execute the task and click Next
  8. Click Finish

You will be presented with a Scheduled Tasks window as follow:

Sheduled Task

We will now need to edit this task slightly to include our custom parameters, such as -m and -t. 

To modify the command line of the shutdown.exe task:

  1. Right click your newly created Task, in our example "Shutdown at 3am" and select Properties
  2. You will be presented with the Edit Shutdown at 3am dialog, notice the command string in the Run text box below.
  3. In the Run text box, add to the end of the command string -s -t 0 and click Apply
  4. If you're asked to re-enter the credentials under which the tast will run, do so.  Click OK
  5. Your Shutdown at 3am Task should look exactly as it is show below.  Take care to ensure that all of the command parameters are quoted as they are below in the Run textbox.

Sheduled Tasks Edit Screen

References

Restart or Shutdown Computers Using CMD and SHUTDOWN Commands from the Command Line
/articles/shutdown-or-restart-computers-remotely.aspx

 

permalink [Permalink] - Updated: Monday, October 28, 2013





| More

 

Articles of Interest


International Careers & Jobs - An international employment directory, reviewing world-wide top job sites


 
 
(c) Capitalhead Pty Ltd
Contact Capitalhead About Us Articles & Publications Partners Solutions & Services Products Valid XHTML Valid CSS