Skip to main content
IT BIBLESign in

Forum / Off-Topic & Miscellaneous / Scripting & Programming

Check Application Version

WizardTux Cool Guy OP
Oct 10, 2022, 4:46 PM UTC
#1

Simple way to get the version of an application via PowerShell.

Param(
    [Parameter(Mandatory=$true)]
    $ApplicationName
)

$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"

if($ApplicationName -ne $null) {
    foreach($obj in $InstalledSoftware) {
        if($obj.GetValue('DisplayName') -eq $ApplicationName) {
            write-host $obj.GetValue('DisplayVersion')
        }
    }
} else {
    foreach($obj in $InstalledSoftware) {
        write-host $obj.GetValue('DisplayName') -NoNewline; write-host " - " -NoNewline; write-host $obj.GetValue('DisplayVersion')
    }
}

Sign in to reply.