Tuesday, August 18, 2009

How to use the remote shutdown command in Windows

This article will show you how to use the remote shutdown command tool in Windows to remotely shut down, restart, or logoff a local or networked computer. This can be very useful sometimes if you have multiple computers at home or on your network that you want to quickly shutdown or restart.

You can perform a remote shutdown from the command prompt using the shutdown command and it’s associated switches, from the remote shutdown dialog box, or from a batch file. I’ll try to go through all three in this guide.

Remote Shutdown Overview

Firstly, in order to remotely shutdown a computer on your network, you’ll need to make sure you have Administrative access to that computer. If you’re on a home network, the best way to do this is to make sure all computers are in the same workgroup and that they all have at least one Administrator account with the same user name and password.

You can also have different Administrator account names across computers, but then you’ll need to make sure you add the Administrator account of one computer to the account list on the other computers. You’ll also need to know all the names of the other computers on the network. You can do that by going to Control Panel and then clicking on System. Then click on the Computer Name tab.

computer name

Remote shutdown is useful for managing multiple computers at once and especially useful for helpdesk technicians when they have to fix remote computers.

Remote shutdown via Command Prompt

The shutdown command is most flexible when using it from the command prompt because you can add a bunch of switches to it, which allow you to customize the behavior. Go to Start, then Run, and type in CMD. In the black command window, type in shutdown /? to see the list of switches.

shutdown command

You have to use at least one switch in order for the command to do anything. Basically you would type in shutdown -X -Y -Z where X, Y, Z are letters in the list above.

Here are a couple of the most command switches and what actions they peform:

-l: Logs off the computer

-s: Shuts down the computer

-r: Restarts the computer

-m \\computername: remote shutdown of a computer

-f: Forces programs to close immediately

So for remotely shutting down another machine on your network, you would type into the command prompt the following commands:

shutdown –m \\computername –r –f

This above command will restart the computer named computername and force all programs that are still running to die.

shutdown –m \\computername –r –f –c “The computer will restart, please save all work.” –t 60

This command will restart the computer named computername, force all programs that are running to die, show a message to the user, and countdown 60 seconds before it restarts.

Remote Shutdown via Shutdown Dialog

If you don’t like all those switches, etc, or using the command prompt, then you can bring up the shutdown dialog box. You can open the dialog window by clicking Start, click Run, type CMD and typing shutdown -i and in the blank DOS window.

shutdown i

A window similar to the one below will appear:

remote shutdown dialog

Click the Add or Browse button to add computers to the list. You can then run the commands on the entire batch of computers. If you click Add, you’ll need to enter in the network name of the computer in the format \\computername. You can even add your own computer to test it out and make sure it works.

computer name[6]

Of course, you need to know the actual computer name, which I mentioned how you can figure out above. You’ll also need Administrative access. You can determine this by going to My Computer and typing \\computername into the address bar and seeing if you can get access without having to be prompted for a password.

compute name my

So add as many computers to the list as you like and then set your options. You can shutdown, restart, or logoff. You can also display a warning for however many seconds you like. You can type in a comment at the bottom which will be displayed to users. That’s it!

Remote Shutdown via Batch File

Finally, you can create a batch file so that you can do all of this by just clicking on a file! Or you can even schedule the batch file to be run at specific intervals using Windows Scheduler.

Just go to Notepad and type in the commands you would have typed into the command prompt:

shutdown –m \\computername1 –r
shutdown –m \\computername2 –r
shutdown –m \\computername3 –r

This will restart three computers on my home network. You would of course replace computername1 with the actual names of your computers. Then simple save the file with a .BAT file extension. You can put as many commands into the batch file as you like, so feel free to experiment!

I’ve written an extensive post on how to use batch files in Windows, so read that if you are not familiar with batch files. Enjoy!

[tags]remote shutdown, remote shutdown command, remote windows shutdown, remote windows xp shutdown, network remote shutdown, remote computer shutdown[/tags]

1 comment:

hrum said...

Also you can use Network Shutdown Tool. You can shutdown, reboot, wake up a group of remote computers with this tool in your domain or workgroup by schedule.
Free download - http://abbyte.com

Google