List installed programs with PowerShell

The function Get-InstalledPrograms will list all programs installed on the local computer and for the current user. Its output should match that of commands such as ms-settings:appsfeatures or %windir%\System32\appwiz.cpl:

function Get-InstalledPrograms {

    param (

    Set-StrictMode -Off;
    if( -not $DisplayName ) {
        $DisplayName = '*';
    Get-ItemProperty -Path $(
    ) -ErrorAction 'SilentlyContinue'
    | Where-Object -Property 'DisplayName' -Like $DisplayName
    | Select-Object -Property 'DisplayName', 'UninstallString', 'ModifyPath'
    | Sort-Object -Property 'DisplayName';

Use this function as follows:

PS C:\> Get-InstalledPrograms *firefox* | Format-List

DisplayName     : Mozilla Firefox 83.0 (x64 en-US)
UninstallString : "C:\Program Files\Mozilla Firefox\uninstall\helper.exe"
ModifyPath      :