PowerShell Script to Check Installed Software List
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion to list installed software with names and versions in PowerShell.Examples
How to Think About It
Algorithm
Code
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Where-Object { $_.DisplayName } |
Select-Object DisplayName, DisplayVersion | Format-Table -AutoSizeDry Run
Let's trace the script on a system with two installed programs: Microsoft Office and Google Chrome.
Read registry keys
Retrieve all subkeys under HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
Filter entries
Keep only entries where DisplayName exists (e.g., Microsoft Office, Google Chrome)
Select properties
Extract DisplayName and DisplayVersion for each entry
| DisplayName | DisplayVersion |
|---|---|
| Microsoft Office 365 | 16.0.12325.20344 |
| Google Chrome | 114.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
Get-CimInstance -ClassName Win32_Product | Select-Object Name, Version | Format-Table -AutoSize
Get-ItemProperty HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName } | Select-Object DisplayName, DisplayVersion | Format-Table -AutoSizeComplexity: 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.
| Approach | Time | Space | Best For |
|---|---|---|---|
| Registry Query | O(n) | O(n) | Fast listing of installed software |
| Get-CimInstance WMI | O(n^2) | O(n) | Detailed info but slower and may trigger repairs |
| WOW6432Node Registry | O(n) | O(n) | Listing 32-bit apps on 64-bit Windows |