Skip to content

Instantly share code, notes, and snippets.

@SweetAsNZ
Last active December 10, 2025 01:45
Show Gist options
  • Select an option

  • Save SweetAsNZ/9b8be273344778f535eb53905236f792 to your computer and use it in GitHub Desktop.

Select an option

Save SweetAsNZ/9b8be273344778f535eb53905236f792 to your computer and use it in GitHub Desktop.
Gets the latest/installed Visual C++ RunTime with PowerShell
function Get-VisualCRuntime {
<#
.SYNOPSIS
Get Visual Studio Latest Installed RunTime
.EXAMPLE
Get-VisualCRuntime
#>
[CmdletBinding()]
Param(
[switch]$Latest # See here for latest https://aka.ms/vc14/vc_redist.x64.exe, https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
)
$GetVCRunTime = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes" -ErrorAction SilentlyContinue |
ForEach-Object {
$name = $_.PSChildName
$props = Get-ItemProperty $_.PsPath
[PSCustomObject]@{
Runtime = $name
Version = "$($props.Major).$($props.Minor).$($props.Bld).$($props.Rbld)"
Installed = $props.Installed
}
} | Where-Object {$_.Installed -eq 1} | Sort Version
if($Latest){
$VCRunTime = $GetVCRunTime | Select -Last 1
}
else{
$VCRunTime = $GetVCRunTime
}
return $VCRunTime
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment