TopicWindows Server →
⌚ About 2 min read
Build an inventory of the software declared in Windows uninstall keys.
Avant de commencer : adaptez toujours les commandes et manipulations à votre environnement. Sur un système de production, prévoyez une backup ou un retour arrière lorsque l’action peut modifier la configuration.
Étapes à suivre
-
1
Open Power Shell
Run Windows Terminal.
-
2
Read 64 bit uninstall keys.
Ask HKLM:softwareMicrosoftWindowsCurrentUninstall version*.
-
3
Add 32 bit view.
Also ask the question: node.
-
4
Sort and export.
Select-Object DisplayName, DisplayVersion, Publisher and export to CSV if necessary.
Commands utiles
Get-ItemProperty HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall*, Where-Object Display Name, Select-Object DisplayNameVersion, Publisher, sort-Object Display Name.
Well- ItemProperty HKLM:softwareWow6432NodeMicrosoftWindowsCurrentVersionUninstall*, Where-Object Display Name, Select-Object DisplayVersion, Publisher, sort-ObjectDisplay1.
À retenir
- Win32_Product is not recommended for a simple inventory as it can trigger MSI controls/repairs.
- Not all softwares report their installation in the same way.
Software inventory: avoid Win32_Product
Technical checkpoints
- Querying Win32_Product can trigger MSI consistency checks/repairs and be very slow; it should not be the first inventory method.
- The 32/64-bit Uninstall registry keys usually provide DisplayName, DisplayVersion and Publisher without triggering MSI.
- MSIX/Store applications use a different mechanism and may require Get-AppxPackage.
Registry inventory
Read both registry views then deduplicate by name/version.
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
Get-ItemProperty HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*Topic-specific pitfalls
- A portable application may not appear in Uninstall keys.
- Comparing only the name can merge different versions or architectures.
How to validate
- Expected versions are found in the source appropriate to their installation type.
- No inventory command triggered MSI repair on production systems.