Skip to content

Check if a particular application is installed using Powershell

function check_if_installed($p1) {
    $software = $p1;
    $installed = ((gp HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Match $p1).Length -gt 0
    If (-Not $installed) {
        Write-Host "'$software'  is not installed.";
    }
    else {
        Write-Host "'$software' is installed."
    }
    return $installed
}
check_if_installed -p1 "Visual Studio Code"

Source

See also  How to divide in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.