fbpx

Unveiling the Amazing PowerShell Get-InstalledSoftware Cmdlet

Keeping track of installed software on a system is crucial for maintenance and troubleshooting. In this article, we delve into the power of the PowerShell Get-InstalledSoftware cmdlet, empowering you to retrieve a comprehensive list of installed software, gather version information, and streamline software management tasks. Join us as we unlock the potential of PowerShell for efficiently managing installed software.

What does the PowerShell Get-InstalledSoftware function do?

The Get-InstalledSoftware function retrieves a list of all software installed on a Windows computer. It queries the Windows registry to access the uninstall keys where software information is stored. By analyzing these keys, it retrieves details such as the software’s name, version, installation location, and GUID.

The function accepts several parameters to customize the query:

  • ComputerName: Specifies the name of the computer to query. If not provided, it defaults to the local computer.
  • Name: Limits the query to software titles that match the specified name.
  • Guid: Limits the query to software entries with the specified GUID.

When the function is executed, it performs the following steps:

  1. Defines a script block that contains the logic for retrieving the installed software.
  2. Accesses the uninstall registry keys for both 32-bit and 64-bit applications.
  3. Filters the software entries based on the provided parameters (Name and Guid).
  4. Creates custom objects for each matching software entry, including properties like Name, Version, InstallLocation, and GUID.
  5. Returns the custom objects representing the installed software.

By using this function, you can easily gather information about the software installed on a Windows computer. It provides a convenient way to query the registry and retrieve software details, which can be useful for inventory management, troubleshooting, or system administration tasks.

Software Installations and the System Registry

In PowerShell, you can retrieve information about installed software on a computer by interacting with the Windows Registry. The Windows Registry stores various configuration settings, including information about installed applications. Here’s how you can access the registry to gather information about installed software:

  • Open the PowerShell console or PowerShell ISE.
  • Use the Get-ItemProperty cmdlet to access the Uninstall registry key, which contains information about installed software. The registry key location is: HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall. $software = Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*"
  • This will retrieve all the subkeys under the Uninstall key, which represent the installed software entries.
  • You can then filter, sort, or manipulate the retrieved data as per your requirements. For example, you can filter the results based on specific criteria or select specific properties of interest.
$filteredSoftware = $software | Where-Object { $_.DisplayName -like "*Microsoft*" } | Sort-Object DisplayName | Select-Object DisplayName, DisplayVersion, Publisher
Unveiling the Amazing PowerShell Get-InstalledSoftware Cmdlet
  • In the example above, we are filtering the software entries to include only those with “Microsoft” in the display name. We then sort the results alphabetically by display name and select only the display name, display version, and publisher properties.
  • Finally, you can display or export the retrieved software information as needed. $filteredSoftware | Format-Table -AutoSize This will display the filtered software information in a table format.

Please note that accessing the Windows Registry requires administrative privileges. Therefore, you may need to run PowerShell with administrative rights to retrieve the installed software information. Additionally, the registry key structure or properties may vary depending on the Windows version or software installed, so you may need to adjust the code accordingly.

Listing out Installed Software via PowerShell

To list installed software using the Get-InstalledSoftware function you provided, you can simply call the function without any parameters. Here's an example:

Get-InstalledSoftware

This will retrieve and display a list of all software installed on the local computer.

If you want to limit the query to a specific software title or GUID, you can provide the -Name or -Guid parameters, respectively. For example:

Get-InstalledSoftware -Name "Microsoft Office"
Listing out Installed Software via PowerShell

This will retrieve and display a list of software with the title "Microsoft Office" installed on the local computer.

You can also query a remote computer by specifying the -ComputerName parameter. For example:

Get-InstalledSoftware -ComputerName "RemoteComputer"
Listing out Installed Software via PowerShell

This will retrieve and display a list of installed software on the computer named "RemoteComputer".

The Get-InstalledSoftware function uses registry keys to gather information about installed software. It retrieves each software entry's display name, version, and installation location and returns the results as custom PowerShell objects.

In conclusion, PowerShell's Unveiling the Amazing PowerShell Get-InstalledSoftware Cmdlet cmdlet provides a powerful solution for managing and retrieving information about installed software on a system. With the knowledge gained from this article, you are now equipped to efficiently gather software details, track versions, and streamline software management tasks. Harness the power of PowerShell to maintain and optimize your installed software ecosystem.