Enumerating Software

Microsoft® Windows® 2000 Scripting Guide

Taking inventory of the software installed on a computer is as important as taking inventory of the hardware installed on a computer. A software inventory helps you:

  • Understand how computers are being used in your organization.

  • Prevent problems associated with users running unauthorized software or software that is incompatible with other software used in your organization.

  • Ensure compliance with software licensing agreements.

In the past, administrators taking software inventories had to purchase third-party tools or use a brute force approach to taking inventory. With the brute force approach, all the .exe and .com files on a computer (any files that potentially represent executable files for software programs) are retrieved. In most cases, this is far more information than you can use. For example, on a typical Windows 2000 Professional-based computer running Microsoft Office and several other software applications, the brute force approach returns 1,742 .exe files. The amount of data returned, and the fact that the only information returned is the file name, can make it hard to determine the actual (and perhaps most meaningful) software products that have been installed on the computer. Among the problems you face when trying to analyze this data are the following:

  • Applications such as Microsoft Word are difficult to distinguish from self-extracting archive files or system files that might also have the .exe extension. In fact, the vast majority of the file names returned are operating system files that are essentially meaningless in an inventory. Very rarely will you be concerned with knowing whether or not Calc.exe or Attrib.exe is installed on all your computers.

    In addition, having an executable file on your computer does not mean that the application has been installed. You could have a file named Winword.exe yet not have Microsoft Word installed.

  • File names might not provide enough information to identify a software program. Many executable file names have no obvious relationship to the name of the software. For example, is it a good thing or a bad thing that the files Qwinsta.exe and W32mkde.exe were found on your file server?

  • Although a list of 1,742 files might be manageable when working with a single computer, when working with multiple computers the brute force method can result in a huge amount of data.

The WMI Win32_Product and Win32_SoftwareFeature classes allow you to enumerate the software and software features that have been installed on a computer using Windows Installer. Limiting enumeration to software installed by Windows Installer does not provide a complete inventory of the applications installed on a computer. However, this approach does offer several advantages over the brute force method:

  • Data retrieval is held to a minimum.

    On the same Windows 2000-based test computer, a script listing only items that were installed using .msi files returned 77 records instead of the 1,742 items returned using the brute force approach.

  • Data retrieval is limited to manageable software (software installed using Windows Installer).

  • Data retrieval can include important details such as the software version number and a more meaningful description of the software (for example, Microsoft® Visual Studio® instead of Mse.exe).

  • Data retrieval can include other items (such as scripts, templates, and help files) that were installed using Windows Installer but that do not have executable files. This can be extremely useful in organizations that have adopted the Windows Installer format and Group Policy as a way to push documents to user workstations.