Forked from RobinBeismann/Detect-VCRedist2015-2022.ps1
Created
November 10, 2024 10:03
-
-
Save Rokcstar333/c537a5d80be7301a0740cd8c9ac11e23 to your computer and use it in GitHub Desktop.
This file contains hidden or 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