// you’re reading...

How in the Tech

Using the Remote Shutdown Command in Windows

Do you have multiple computers on your network, either in your home or office, that you’d like to logoff, restart, or shutdown outright? This may seem like a rather specific situation for most but let me share a real world example of where this may come in handy. At the office there are occasions where work must be done after hours in order to avoid disruptions to the network or it’s services. In your heads-up email you ask your co-workers to please log off at days end because the work in question is affected by having open connections out across the LAN - if you user has their home directory mounted off the server you want to work on this could pose some problems for you, for example. As you are likely aware, there will always be a handful of users who do not honor this request. What do you do? Well, being a polite person you can log them off yourself manually, or more intelligently, remotely with what I’m about to show you.

Modern versions of Windows have a command line utility called shutdown that allows you to remotely shutdown, restart, or logoff a local or networked computer. The process is quite straightforward and the only requirements are knowing the computer name and having local admin rights on it.

  1. If you do not know the computer name it can be determined by launching a Command Prompt window by clicking Windows Key+R and typing cmd. In the opened command prompt just type hostname to return the computer’s name. There are a few other methods to retrieve this, but I find this the quickest. Of course, if you are attempting to address the example I used above this will become quite tedious. But, you already know all the computer names on your network right?
  2. From that same command prompt run shutdown /? to list all the available switches.

  3. To shutdown a remote computer use the following syntax: shutdown -m \\computer -s -f.
  4. A restart is similar: shutdown -m \\computer -r -f

So now to solve the problem above we can create a batch file network_shutdown.bat created with Notepad that has a shutdown command with appropriate options on each line - one for each networked computer. Running the .bat file will execute each shutdown line in sequence!

Alternatively, if the command line is a bit much for you, shutdown also has a GUI dialog that provides the same functionality. Try Windows Key+R then shutdown -i.

If you want to be notified the next time I write something please subscribe to my RSS feed. Thanks for reading!

Related Posts

Discussion

No comments for “Using the Remote Shutdown Command in Windows”

Post a comment