Using PsShutdown and Shutdown Commands in Corporate Networks
This article provides an overview of PsShutdown and shutdown commands usage in corporate networks, describe their advantages and limitations.
Every new Windows version comes with improved administration toolkit that includes new and extends existing features. Standard Windows shutdown command (known as shutdown.exe) is regularly updated by Microsoft to allow administrators use it to shut down and reboot local and remote PCs. PsShutdown is another free command-line tool for remote shutdown of PCs, that can be used in networks. Both utilities can be used by administrators to create simple custom PC power management solutions.
What You Can and Can't Do with Windows Shutdown Command?
Using standard Windows shutdown command is a obvious first choice for network administrator who would like create a custom power management system. The standard utility is available in Windows installation, so it's free to use, and, of course, it allows to turn off a remote PC. In the command line you can specify a target PC to shutdown using /m parameter. In order to turn off multiple PCs you need to prepare a text file with a list of remote computer names or IP addresses written on every line and pass it to batch script that reads lines one-by-one and performs remote action:
for /f %%i in (list-of-computers.txt) do ( shutdown.exe /s /f /m \\%%i /t 60 /c "regular shutdown" )
Limitations of Windows Shutdown Command
When you run this script remote shutdown command will be executed for all PCs from the list-of-computers.txt file. Specified command-line parameters allows to show a message on remote PCs and give remote user 60 seconds to complete current tasks and save files. It seems to meet the goal to shutdown remote PCs, but once you try to use it on practice you quickly notice that this solution is far from perfect. Used timeout can be not enough in some cases and may lead to loosing important data by users. Also in most cases you need to execute this script to turn off only unused PCs and let active user to continue their tasks. But Windows shutdown command doesn't have options to allow remote user to cancel operation.
If you have a complex network configuration that consists of different workgroups and domains of if your PCs have different administrative credentials, you will fail to use Windows shutdown command to manage all PCs in such configuration. Standard shutdown utility requires administrative access to remote PCs that should be managed, but it misses an option to specify credentials, so operation is performed with your current credentials. That's why operations fail across workgroups/domains or on PCs that have different administrative credentials.
Why PsShutdown is Better Than Windows Shutdown Utility?
In corporate networks standard shutdown.exe command can't be seriously considered as a basis for PC power management solution due to its limitations. PsShutdown utility addresses some of them and it can be a good choice for administrators who would like to build a basic custom solution for turning off remote PCs.
Shutdown Cancellation by Interactive User
One of the most important flaws of the standard Windows utility, that is addressed by PsShutdown is a special option that allows remote user to cancel shutdown operation. In this case user gets a dialog box with a message, countdown timer and a button to cancel operation. To allow interactive user to cancel a shutdown you have to use -c option:
psshutdown.exe -s -f -c -t 60 -m "regular shutdown" \\pc-name
Execution Operation at Specific Time
If you like to execute operation not right now, but at specific time, you can set value for -t parameter as hours and minutes in 24-hour notation. It helps to emulate simple scheduling for remote operations. For example, to shutdown pc at 20:15 execute following command:
psshutdown.exe -s -f -c -t 20:15 -m "regular shutdown" \\pc-name
Operating with Multiple PCs
PsShutdown has more flexible syntax to specify remote PCs than the standard utility. As demonstrated on examples above, you can specify the name of remote PCs using double-slash and computer name. You can also list multiple PCs, separated by comma:
psshutdown.exe -s -f -c -t 60 \\pc-name-1,pc-name-2,pc-name-3
If you need to target all PCs in the domain you can use asterisk:
psshutdown.exe -s -f -c -t 60 \\*
With the standard utility if you need to execute operation on a particular group of computers which names are stored in the text file, you need to use Windows scripting. PsShutdown allows you to execute operation with multiple PCs by specifying path to a text file that stores computer names without leading double-slash on every line:
psshutdown.exe -s -f -c -t 60 @list-of-computers.txt
Specifying Administrative Credentials
In order to manage remote PC with PsShutown you should have administrative privileges. If your account doesn't have administrative permissions on remote PC, you can specify username and password to be used:
psshutdown.exe -s -f -c -t 60 -u username -p password @list-of-computers.txt
Limitations of PsShutdown
PsShutdown, as well as standard Windows shutdown command doesn't need to be installed on remote PCs. But it works like a distributed systems, so has specific requirements for network environment. Every time when you execute remote operation with PsShutdown, it installs and starts service on target PCs though an access to their Admin$ shares. Then PsShutdown sends command to service and once operation is complete, it stops and uninstall service. Therefore to use PsShutdown you have to enable file sharing on computers that should be managed remotely and provide an access to Admin$ share through the Common Internet File System (CIFS)/Server Message Block (SMB) and Remote Procedure Call (RPC) TCP/IP ports.
Are You Looking for Something Else?
Both Windows shutdown command and PsShutdown utility allow to shut down, hibernate, reboot, log off users on remote PCs. But they don't offer features to turn PCs on. If you plan to organize effective PC power management in your organization, you have to care not only about turning off PCs at night, but also about turning them on at morning. You can find this functionality together with advanced operations scheduling, easy troubleshooting and other features in professional PC power management tools from EMCO, 1E, Verdiem and other vendors. EMCO Remote Shutdown is one of the most robust and cost-effective solutions now on market. Try it if you are looking for ready-to-use power management solution.