0
0
PowershellHow-ToBeginner · 2 min read

PowerShell Script to Check Installed Software List

Use Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion to list installed software with names and versions in PowerShell.
📋

Examples

InputRun script on a system with Microsoft Office and Chrome installed
OutputDisplayName: Microsoft Office 365 DisplayVersion: 16.0.12325.20344 DisplayName: Google Chrome DisplayVersion: 114.0.5735.199
InputRun script on a system with no software installed in the uninstall registry key
Output
InputRun script on a system with some software missing DisplayVersion
OutputDisplayName: Example App DisplayVersion: DisplayName: Another App DisplayVersion: 2.1.0
🧠

How to Think About It

To check installed software, look into the Windows registry where installed programs are listed under a specific path. Use PowerShell to read these registry keys and extract software names and versions. This gives a simple list of installed applications.
📐

Algorithm

1
Access the registry path for installed software.
2
Get all subkeys representing installed programs.
3
Extract the DisplayName and DisplayVersion properties from each.
4
Filter out entries without a DisplayName.
5
Output the list of software names and versions.
💻

Code

powershell
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Where-Object { $_.DisplayName } |
Select-Object DisplayName, DisplayVersion | Format-Table -AutoSize
Output
DisplayName DisplayVersion ----------- -------------- Microsoft Office 365 16.0.12325.20344 Google Chrome 114.0.5735.199
🔍

Dry Run

Let's trace the script on a system with two installed programs: Microsoft Office and Google Chrome.

1

Read registry keys

Retrieve all subkeys under HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*

2

Filter entries

Keep only entries where DisplayName exists (e.g., Microsoft Office, Google Chrome)

3

Select properties

Extract DisplayName and DisplayVersion for each entry

DisplayNameDisplayVersion
Microsoft Office 36516.0.12325.20344
Google Chrome114.0.5735.199
💡

Why This Works

Step 1: Access registry uninstall keys

The registry path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall contains keys for installed software.

Step 2: Filter valid software entries

Some keys may not have a DisplayName, so we filter to only show entries with a name.

Step 3: Select and display software info

We select DisplayName and DisplayVersion to show the software name and its version clearly.

🔄

Alternative Approaches

Using Get-CimInstance
powershell
Get-CimInstance -ClassName Win32_Product | Select-Object Name, Version | Format-Table -AutoSize
This queries installed software via WMI but is slower and can trigger software repair actions.
Checking 32-bit registry path
powershell
Get-ItemProperty HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName } | Select-Object DisplayName, DisplayVersion | Format-Table -AutoSize
This lists 32-bit applications on 64-bit Windows systems.

Complexity: O(n) time, O(n) space

Time Complexity

The script reads all uninstall registry keys once, so time grows linearly with the number of installed programs.

Space Complexity

It stores the list of software entries in memory, proportional to the number of installed programs.

Which Approach is Fastest?

Reading registry keys directly is faster than querying WMI with Get-CimInstance, which is slower and can have side effects.

ApproachTimeSpaceBest For
Registry QueryO(n)O(n)Fast listing of installed software
Get-CimInstance WMIO(n^2)O(n)Detailed info but slower and may trigger repairs
WOW6432Node RegistryO(n)O(n)Listing 32-bit apps on 64-bit Windows
💡
Run PowerShell as Administrator to ensure access to all registry keys for installed software.
⚠️
Forgetting to filter out entries without DisplayName can cause empty or confusing output.