3

Is there an option to find installed software with the PowerShell? Mainly software is installed on a MSI basis. I tried it with the following code but I am not sure if it works reliable and for every software product. For example, 32- and 64-bit?

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | `
Select DisplayName, DisplayVersion, Publisher, InstallDate | sort {[string]$PSItem}

Is there a reliable way to find every installed software?

2
  • The contents of that registry key will be the same software you see under the control panel in 'Programs and Features', additionally there are Hotfixes and of course non MSI software. Commented Aug 10, 2015 at 9:41
  • To be complete, the above would have to check both HKLM locations (32-bit and 64-bit) as well as HKCU. Of course that may not make a difference in practice on a given machine. Commented Aug 10, 2015 at 11:54

3 Answers 3

5

You can find all information about installed software, updates and hotfixes with the following PowerShell commands:

try{
    $InstalledSoftware = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
    $InstalledSoftware += Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
} catch {
    Write-warning "Error while trying to retreive installed software from inventory: $($_.Exception.Message)"
}

If I you want to find the installed MSI's, you could use the following:

$InstalledMSIs = @()
foreach ($App in $InstalledSoftware){
    if($App.PSChildname -match "\A\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}\z"){
        $InstalledMSIs += New-Object PSObject -Property @{
            DisplayName = $App.DisplayName;
            DisplayVersion = $App.DisplayVersion;
            Publisher = $App.Publisher;
            InstallDate = $App.InstallDate;
            GUID = $App.PSChildName;    
        }
    }
}

Also, you can check the installed Features on a Windows Server 2008 or higher OS with the following command:

Get-WindowsFeature -ErrorAction Stop | Where-Object {$_.Installed} | Sort-Object DisplayName
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for your addition. Now I get both 32- and 64-bit software. Additionally, is there a possibility to get the MSI product code out of the results as well?
The MSI product code is the name of the key directly under the Uninstall key. You can find this name by selecting PSChildname and match it with a regex $InstalledSoftware[0].PSChildName -match "\A\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}\z". Shall I update my answer with an example?
Thanks for your quick response. An Example would be very nice! THX
Something like this..?
0

Surprisingly few people know about get-package. You can limit the output by programs or msi provider types. Uninstall-package works with msi installs. Otherwise you'll have to do something with $_.metadata['uninstallstring']. This stopped working in powershell 7.

get-package

Comments

-2

Below command will give you all the details about all the installed softwares (I believe this is more reliable).

Get-WmiObject -Class Win32_Product

3 Comments

Thanks for this approach, The result looks definitely more beautiful than the approach with the regkeys, but there are some software products that are not displayed here. For example, I installed Foxit Reader and this software is only displayed when looking into the regkeys but unfortunately not with wmi ...Do you have any ideas why?
Win32_Product only shows Windows Installer (MSI) installations, so it is not good enough for Application Inventory. The uninstall registry-key in HKLM+HKCU Software\Microsoft AND Software\Wow6432Node\Microsoft is the best way AFAIK.
Win32_product is broken : querying this class will force a reregister (and sometimes a repair) on all registered MSI applications (that's why it's so slow). Check your application event logs after querying this class to see what I mean.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.