how to install microsoft C ++ Redistributable if not installed using PowerShell

Viewed 33

I'm trying to write a function that checks for installed versions of Microsoft Visual C++ Redistributable and NOT install if the version found is current or greater. Is there something I could add to the end of the $Software var that would check for newer versions?

Function Check-Version {
$software = "Microsoft Visual C++ 2019 X64 Additional Runtime - 14.28.29913";
$installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -eq $software }) -ne $null

If(-Not $installed) {
    Write-Host "'$software' Not Found.";
} else {
    Write-Host "'$software' Found."
 }`enter code here`
}

Thanks

0 Answers
Related