2023-03-14

Check for App Version on Windows

 I need a powershell to check for an application version

Sure, here's an example PowerShell script that you can use to check the version of an application:


bash

$applicationName = "Your Application Name"

$applicationPath = "C:\Program Files\Your Application Path\YourApplication.exe"

$applicationVersion = (Get-Item $applicationPath).VersionInfo.FileVersion


Write-Host "The current version of $applicationName is $applicationVersion."

In this script, you need to replace the placeholders with the actual name and path of the application that you


==================

can we check the version by looking on the registry?

Yes, you can also check the version of an application by looking it up in the registry. Here's an example PowerShell script that retrieves the version of an application from the registry:


bash

Copy code

$applicationName = "Your Application Name"

$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"

$applicationKey = Get-ChildItem $registryPath | Where-Object {$_.GetValue("DisplayName") -eq $applicationName}


if ($applicationKey) {

    $applicationVersion = $applicationKey.GetValue("DisplayVersion")

    Write-Host "The current version of $applicationName is $applicationVersion."}

else 

    {Write-Host "Could not find $applicationName in the registry."}



In this script, you need to replace the $applicationName variable with the name of the application you want to check. The script searches for the application in the Uninstall key of the registry, and retrieves the DisplayVersion value, which typically contains the application version number.

Note that the location of the Uninstall key may vary depending on the application and the version of Windows you are using, so you may need to modify the $registryPath variable if the key is located elsewhere.