Search code examples
powershellwindows-installer

How to find installed Software with PowerShell?


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?


Solution

  • 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