Remote Shutdown Tool to Shutdown, Restart, or Logoff a Local or Networked Computer

image

The shutdown command can be use via the command prompt, the remote shutdown dialog window, or in a batch file.  You can logoff, shutdown, or restart a computer with this tool.  You can even set the shutdown tool to perform a task at a certain time on certain days and to many computers at one time using a batch file.

This is a good tool to easily shutdown or restart lots of computers on a network at one time.  It can also be handy for helpdesk technicians when fixing remote computers.

The Switches

The shutdown command has a few options called switches.  You can always see them by typing shutdown -? in the command prompt if you forget any of them.

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c
omment"] [-d up:xx:yy]


-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)

Please note: I?ve noticed using a switch with a – sign doesn?t work sometimes. If you are having trouble try using a / in place of – in your switches.

Examples

shutdown ?m \\computername ?r ?f  This command will restart the computer named computername and force any programs that might still be running to stop.

shutdown ?m \\computername ?r ?f ?c ?I?m restarting your computer.  Please save your work now.? ?t 120  This command will restart the computer named computername, force any programs that might still be running to stop, give to user on that computer a message, and countdown 120 seconds before it restarts.

shutdown ?m \\computername ?a  This command will abort a previous shutdown command that is in progress.

Using a Batch File

You can create a file that performs the shutdown command on many computers at one time.

In this example I?m going to create a batch file that will use the shutdown command to shut down 3 computers on my home network before I go to bed.

Open notepad and type the shutdown command to shut down a computer for each computer on the network.  Make sure each shutdown command is on its own line.  An example of what should be typed in notepad is below.

shutdown ?m \\computer1 ?s
shutdown ?m \\computer2 ?s
shutdown ?m \\computer3 -s

shutdown -m \\computer1 -s -t 1

this will shutdown computer1 in 1sec

Now I?ll save it as a batch file by going to file, save as, change save as type to all files, give the file a name ending with .bat.  I named mine shutdown.bat.  Pick the location to save the batch file in and save it.

When you run the batch file it?ll shutdown computer1, 2, and 3 for you.

 

Make sure firewall is turned off or have these port open in the firewall

 

image

Port need to be open:

TCP 139
TCP 445
UDP 137
UDP 138

 

 

Display a local share
NET SHARE sharename
Display a list of computers in the current domain.
NET VIEW
To see a list of shares on a remote computer
NET VIEW \\ComputerName
To see a list of all shares in the domain:
NET VIEW /DOMAIN
To see a list of shares on a different domain
NET VIEW /DOMAIN:domainname
To see a list of shares on a remote Netware computer
NET VIEW /NETWORK:NW [\\ComputerName]

Leave a Reply

You must be logged in to post a comment.