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

User based detection

function getloggedindetails () {     ##Find logged in username     $user = Get-WmiObject Win32_Process - Filter "Name='explorer...

Search This Blog