by   July 20 2011   
How to restart SBS 2003 from the command line. Working on a system that you need to restart remotely? Looking over the SBS2003 options I had to come up with a couple of scripts to handle restarting my SBS2003 server remotely and on a schedule.

(Found this reference at TechRepublic great IT place by the way.)

I have posted the notes here to setup some scripts for other networks.

From the command line, you can shut down or reboot any Windows Server 2003 computer (or even Windows XP or Vista machines) with the Shutdown.exe command. (Note: The exe file extension is optional for the Shutdown command.) Shutdown.exe contains a number of switches that allow you to specify different actions for the server when the Shutdown command executes. The Shutdown.exe switches are as follows:
/? Displays the Help listing
/i Displays the graphical user interface (GUI); it must be the first option
/l Logs off the current user; it cannot be used with the /d or /m options
/s Shuts down the computer
/r Shuts down and restarts the computer
/g Shuts down and restarts the computer and then restarts any registered applications
/a Aborts system Shutdown
/p Turns off the local computer with no timeout or warning
/h Hibernates the local machine
/e Documents the reason for shutting down the computer
/m Specifies the target computer; it is used with \\computername
/t xxx Where xxx is the number of seconds before Shutdown
/c “comment” Where "comment" is the reason for the Shutdown or restart
/f Forces running applications to close without warning users
/d [p|u:]xx:yy Provides the reason for the Shutdown action: p = planned; u= unplanned; xx supplies the major reason code; yy = supplies the minor reason code

When you enter a Shutdown with no arguments, the Help listing will display. The Help listing also includes the reason codes available for use with the /d switch.

You can use many of these switches in conjunction with one another when issuing the Shutdown command. A usage example for the Shutdown command follows:

Shutdown /r /c "Hanging Application or service" /t 30

This example would restart the local machine storing the comment provided with the /c switch. Windows would wait 30 seconds before initiating the restart. You might also create a batch file to use when it is necessary to restart a server in a remote location. The batch file might look like this:

Shutdown /m \\remote /r /c "Remote Restart" /t 45

If you have an UPS that allows command line entries you might try this setup. 

shutdown -s -f -m \\192.168.1.17 -t 60

I have one UPS that controls 2 servers and one is not that important to keep on during a power outage. 

I have the older server start it's shutdown 5 minutes into the power outage and the main server will start the shutdown process 3 hours into the outage or never if the generator is kicked on during the longer outage. 

The IP address method works when your firewall allows. I run 3 subnets + WiFi and Print networks to make a total of 4 which do not allow much for cross over except from the main server. Setup your software on your Hyper-V Core if you are running Hyper-V and the UPS 

How to restart SBS 2003 from the command line. Working on a system that you need to restart remotely? Looking over the SBS2003 options I had to come up with a couple of scripts to handle restarting my SBS2003 server remotely and on a schedule.