Get-InstalledApp.ps1 is a PowerShell script that outputs information (e.g., display name, version, publisher) about the applications installed on one or more computers in a network. When I wrote this script back in 2009, I was using PowerShell 1.0 and only had to access 32-bit Windows OSs (see the web-exclusive article “What Applications Are Installed on the Computers in Your Network?”). Fast forward to 2011. I’m now using the 64-bit version of Windows 7, which has PowerShell 2.0 built-in. I wanted to use Get-InstalledApp.ps1 to output information about the applications installed on 64-bit and 32-bit Windows computers and instantly discovered that when I ran the script from the 64-bit version of PowerShell 2.0, it output only 64-bit applications. I had to start a 32-bit instance of PowerShell to find 32-bit applications. Needless to say, I was unhappy with this limitation.
I’ve now written a new version of Get-InstalledApp.ps1. It addresses this limitation and adds some new features, some of which should be particularly useful for people managing both 32-bit and 64-bit applications. The new version of the script requires PowerShell 2.0 and provides the following enhancements:
Using the Script
To download Get-InstalledApp.ps1, scroll to the top of this page and click the 136129.zip hotlink. The script's command-line syntax is as follows:
Get-InstalledApp[-ComputerName <String[]>]
[-AppID <String>]
[-AppName <String>]
[-Publisher <String>]
[-Version <String>]
[-Architecture <String>]
[-MatchAll]
The -ComputerName parameter is optional. If you omit it, the script outputs information about the applications installed on the local computer. If you pipe input to the script, the script uses the piped input for the -ComputerName parameter. Because it’s the first positional parameter, you can omit the parameter’s name (-ComputerName) if you specify a computer name (or a list of computer names) as the script's first parameter.
The optional -AppID parameter lets you search for a particular application by its ID. The application ID is the application's registry subkey name, which is under the Uninstall key in the registry. This parameter is particularly useful for searching for applications installed with Windows Installer, as the application ID is the same as the application's product code globally unique identifier (GUID). You can use wildcards in the -AppID parameter's value. If the value contains curly braces ({ }), you need to enclose it in double quotes (" "); otherwise, PowerShell will think you’re specifying a hash table.
The optional -AppName, -Publisher, and -Version parameters behave the same way as in the earlier version of the script. These parameters let you search for applications by name, publisher, and version, respectively. All three parameters support wildcard matching and are case insensitive.
You can specify one of two strings—64-bit or 32-bit—for the optional -Architecture parameter, depending on whether you want to search for 64-bit or 32-bit applications. If you omit the -Architecture parameter, Get-InstalledApp.ps1 outputs information about both 64-bit and 32-bit applications.
When you’re looking for only one match (e.g., searching for an application by its ID), it’s unnecessary to continue the registry enumeration. So, the script returns only the first match by default to minimize network and registry access. When you need all the matches, you can use the -MatchAll parameter. If you include this parameter, the script lists the information about all matching applications instead of stopping after the first match. For example, the command
Get-InstalledApp -Publisher *Microsoft*
outputs information about the first application whose publisher contains the string Microsoft, whereas the command
Get-installedApp -Publisher *Microsoft*
-MatchAll
outputs information about all applications whose publisher contains the string Microsoft. (Although this command wraps here, you'd enter it all on one line in the PowerShell console. The same holds true for the other commands that wrap.)