Skip to content

Get-InstalledProgram

Windows: Lists installed software and programs

#Requires -Version 5.1

[CmdletBinding()]
Param
(
    [string]$ComputerName = $env:COMPUTERNAME,

    [string]$Name,

    [switch]$IncludeSystemUpdates
)

Process
{
    try
    {
        $scriptBlock = {
            Param($FilterName, $IncludeUpdates)

            $registryPaths = @(
                "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*",
                "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*",
                "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*"
            )

            $results = foreach ($path in $registryPaths)
            {
                Get-ItemProperty $path -ErrorAction SilentlyContinue | ForEach-Object {
                    if (-not [string]::IsNullOrWhiteSpace($_.DisplayName))
                    {
                        if (-not $IncludeUpdates -and ($_.ReleaseType -eq "Security Update" -or $_.ReleaseType -eq "Update" -or $_.DisplayName -match "KB\d{6,7}"))
                        {
                            return
                        }

                        [PSCustomObject]@{
                            Name            = $_.DisplayName
                            Version         = $_.DisplayVersion
                            Publisher       = $_.Publisher
                            InstallDate     = $_.InstallDate
                            UninstallString = $_.UninstallString
                            Source          = $_.InstallSource
                        }
                    }
                }
            }

            if (-not [string]::IsNullOrWhiteSpace($FilterName))
            {
                $results = $results | Where-Object { $_.Name -like $FilterName }
            }

            return $results | Sort-Object Name
        }

        if ($ComputerName -ne $env:COMPUTERNAME)
        {
            $result = Invoke-Command -ComputerName $ComputerName -ScriptBlock $scriptBlock -ArgumentList $Name, $IncludeSystemUpdates
        }
        else
        {
            $result = &$scriptBlock -FilterName $Name -IncludeUpdates $IncludeSystemUpdates
        }

        Write-Output $result
    }
    catch
    {
        throw
    }
}

Specifies the name of the computer to query. Defaults to the local computer.

Specifies a filter for the program name (supports wildcards).

Off

If set, includes Windows Updates and system components in the list.

An interactive directory of PowerShell scripts.