How to Find Installed Software Using PowerShell?

As a system administrator, I manage multiple computers in the organization. Recently, I got a requirement to find software installed in a system. In this tutorial, I will explain how to find installed software using PowerShell.

Note: You need to have administrative privileges on the system where you want to find software installed.

Find Installed Software Locally using PowerShell

Now, let me show you how to find installed software locally using PowerShell. There are different methods to do and here are they:

1. using Get-WmiObject

The Get-WmiObject cmdlet is used to query Windows Management Instrumentation (WMI) classes. To find installed software, you can query the Win32_Product class. Here’s how you can do it:

Get-WmiObject -Class Win32_Product | Select-Object -Property Name, Version, Vendor

This command will list the name, version, and vendor of each installed software. However, it’s important to note that Win32_Product might not list all installed software, as it only includes applications installed using Windows Installer.

Here is the exact output in the screenshot below:

Find Installed Software Using PowerShell

Check out Enable WinRM (Windows Remote Management) Using PowerShell

2. Using the Registry

Another method to find installed software is by querying the registry. Software information is often stored in the registry under specific keys. Here’s a script to list installed software by querying the registry:

$installedSoftware = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Select-Object DisplayName, DisplayVersion, Publisher

$installedSoftware += Get-ChildItem -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Select-Object DisplayName, DisplayVersion, Publisher

$installedSoftware | Where-Object { $_.DisplayName -ne $null } | Format-Table -AutoSize

This script queries both the 32-bit and 64-bit registry paths to ensure a comprehensive list of installed software.

Here is the exact output in the screenshot below:

Find Installed Software Locally using PowerShell

Check out Enable Remote Desktop Using PowerShell

Find Installed Software Remotely using PowerShell

Now, let me show you how to find installed software remotely using PowerShell.

When managing a network of computers, you often need to find installed software on remote machines. PowerShell makes this task straightforward with the Invoke-Command cmdlet.

Using Invoke-Command

Here’s an example of how to use Invoke-Command to run a script on a remote computer:

$computers = "ComputerName1", "ComputerName2"
$scriptBlock = {
    Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Select-Object DisplayName, DisplayVersion, Publisher
    Get-ChildItem -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Select-Object DisplayName, DisplayVersion, Publisher
}

Invoke-Command -ComputerName $computers -ScriptBlock $scriptBlock

Replace "ComputerName1" and "ComputerName2" with the names of the remote computers you want to query. This script will return the installed software from each specified computer.

Check out Uninstall a Program with PowerShell

Combine Results from Multiple Machines

In a real-world scenario, you might need to combine results from multiple machines into a single report. Here’s an advanced script to achieve this:

$computers = "ComputerName1", "ComputerName2"
$results = @()

foreach ($computer in $computers) {
    $scriptBlock = {
        Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Select-Object DisplayName, DisplayVersion, Publisher
        Get-ChildItem -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Select-Object DisplayName, DisplayVersion, Publisher
    }

    $results += Invoke-Command -ComputerName $computer -ScriptBlock $scriptBlock
}

$results | Where-Object { $_.DisplayName -ne $null } | Format-Table -AutoSize

This script loops through each computer, runs the query, and combines the results into a single array. The final output is formatted as a table for easy readability.

Read How to Uninstall Microsoft Edge Using PowerShell?

Handle Permissions and Security

When running scripts on remote computers, you need appropriate permissions. Ensure you have administrative rights on the target machines and that PowerShell Remoting is enabled. You can enable PowerShell Remoting with the following command:

Enable-PSRemoting -Force

Additionally, you might need to configure the firewall to allow remote commands. Use the following command to enable the necessary firewall rules:

Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC" -RemoteAddress Any

Conclusion

In this tutorial, I explained how to find installed software using PowerShell using different methods, such as Get-WmiObject, querying the registry, and using Invoke-Command for remote queries, etc.

You may also like:

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.