$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"
}