When it comes to corporate desktop management, administrators typically rely on utilities such as Microsoft's System Center line of products. However, many common Windows desktop manager functions can be performed from the command line without having to invest in expensive management software.
Although PowerShell might seem the obvious choice for command-line management, it isn't the only tool available. Microsoft offers other command-line tools that are also worth looking at. PowerShell can certainly handle most desktop management tasks for Windows 7 or 8, but it often requires complex scripts. For example, Microsoft's "Quick and Dirty" software inventory actually relies on a rather elaborate PowerShell script.
What is the best approach to managing enterprise desktops from the command line? Remember, there is no need to reinvent the wheel. Microsoft has created a number of PowerShell scripts for desktop management that you can download and adapt to your own purposes, such as a Windows 7 machine system inventory script.
Another way to simplify things is to take advantage of a Microsoft command-line tool called PSInfo that you can use for extracting Windows desktop manager information. The PSInfo tool isn't native to Windows; it's a part of the PSTools collection.
First, make sure that the Remote Registry service is running on any desktops that you plan to manage using this tool. The Windows desktop manager can be run against any machine running Windows XP or higher, and it supports Windows Server 2003 and above.
You can use the tool to, for example, determine which patches are installed on a desktop or how much free disk space a desktop has. In addition, if you want to see which hotfixes have been applied to a desktop, you could use the command PSInfo -H.
Of course, targeting a single desktop might be helpful for one-off troubleshooting situations, but it is not practical for large-scale desktop management. Fortunately, PSInfo does contain functionality that allows it to work on a larger scale.
More on Windows desktop manager tools
Consider these third-party Windows management tools
Windows Intune brings the cloud to desktop management
Popular enterprise desktop management tips of the year (so far)
Windows 8 SkyDrive blurs the lines between the desktop and the cloud
Maintain Windows 7 with these command-line utilities
Top 10 ways to improve desktop management
PowerShell scripts can make Windows virtualization easier
Software for desktop management starts to go mobile
Third-party tools can help monitor Active Directory
You can use the \\Computer parameter to run PSInfo against a specific remote desktop. However, even that might not be practical if you want to query a large number of remote systems. In those cases, you are better off using the @file parameter. The @file parameter allows you to specify the name of a text file containing a list of the computers that you want to target.
If you are planning to target a number of remote desktops, you should also consider security and how to handle the command's output.
As previously mentioned, you will have to enable the Remote Registry service on all of the target machines. This service allows the PSInfo utility to gain access to the remote machine's configuration, but you do have to consider the security implications of enabling this service.
This brings me to my second point with regard to security. Enabling the Remote Registry service doesn't create an unobstructed pipe into the remote machine. You still have to provide the appropriate credentials to access the remote desktops. This is done by way of the –U switch and the –P switch. Use the –U switch to provide a username and the –P switch to provide the password. If you are targeting multiple remote machines, then the credentials that you provide must be valid for all of the target desktops.
As for controlling the command's output, you can view the output on screen. If you are examining more than one desktop, it's easier to use the –C switch to create a CSV file. There is also a Filter parameter that shows only a desired field. For instance, use the Service filter to create a report of the service packs that have been applied to each target computer.
This brings up another point. I have talked about using the PSInfo tool for update monitoring, but you can use it for plenty of other things. For example, the –S switch can be used to display a list of the applications that are installed on the target system. Similarly, the –D switch can be used to display disk volume information.
You can also use the PSInfo tool to gather hardware inventory information, and you don't even need to provide any command-line switches. Simply entering the PSInfo command provides hardware inventory information for the target system.
As you can see, there are some really great commands for managing Windows desktops. Although PowerShell cmdlets are good for querying Windows 7 and 8 desktops, the PSInfo tool is a better choice for those with legacy desktop operating systems or for those who wish to avoid the complexity of PowerShell.