Created
August 4, 2022 09:37
-
-
Save RobinBeismann/e1fa42f31c19e856b3e479e94c48ef93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[array]$AppName = "Microsoft Visual C++ 2015-2019", "Microsoft Visual C++ 2015-2022" | |
[version]$RequiredVersion = "14.27.29112.0" | |
[string]$Architecture = "x64" | |
[array]$Hives = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\", | |
"Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" | |
$Hives | ForEach-Object { | |
Get-ChildItem -Path $_ | ForEach-Object { | |
$Properties = $_ | Get-ItemProperty | |
if( | |
$Properties.DisplayName -and | |
$Properties.DisplayName.Contains("$("($Architecture)")") -and | |
( | |
$AppName | Where-Object { | |
$Properties.DisplayName.StartsWith($_) | |
} | |
) | |
){ | |
$CurrentVersion = [version]$Properties.DisplayVersion | |
if($CurrentVersion -ge $RequiredVersion){ | |
"installed" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the feedback!