Pages

Thursday, 20 January 2022

Installed application is higher than current version

$currentversion = "97.0.4692.90"

function Get-ApplicationVersion {
    $applicationName = "Google Chrome"
    $my_check = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, InstallDate | Where -Property DisplayName -Match $applicationName
    $versionNumber = $my_check.DisplayVersion
    if ($my_check) {
        $versionNumber
    }
    else {
        write-warning "Application not found"
    }
}
$version = Get-ApplicationVersion
If ($version -gt $currentversion) {
Write-host "Alredy higher version installed in the machine"
}
Else {
Write-host "Installing the current version"
}

No comments:

Post a Comment

test

 # Set the file path you want to check $filePath = "C:\Path\To\Your\File.exe" # Check if file exists if (Test-Path $filePath) {   ...

Search This Blog