Microsoft Visual C++ Redistributable is a collection of runtime components and libraries provided by Microsoft to ensure that applications built using Microsoft Visual C++ programming language have access to the necessary resources and dependencies on a user’s computer. So lets delete them as they are no longer supported.
As older versions of Visual C++ are not needed anymore there is a quick way to detect and remediate these applications from end devices using Intune remediations.
Below is the script needed to detect and remediate the versions of Visual C++, you can change the Paths to the versions you need.
Detection script
#Microsoft Visual C++ 2005 Detection script
$Cplusplus2005Installed = Test-Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{710f4c1c-cc18-4c49-8cbf-51240c89a1a2}'
if ($Cplusplus2005Installed -eq 'True') {
Write-Host "C++ is installed"
exit 1
}
else {
#No remediation required
Write-Host "C++ 2005 is not installed"
exit 0
}
catch {
$errMsg = $_.Exception.Message
Write-Error $errMsg
exit 1
}
Remediation script
$x86RegistryPath = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{710f4c1c-cc18-4c49-8cbf-51240c89a1a2}'
# Function to uninstall a program based on its registry path
function Uninstall-Program {
param(
[string]$registryPath
)
# Check if the registry key exists
if (Test-Path $registryPath) {
Write-Host "Uninstalling Microsoft Visual C++ 2005..."
# Get the uninstall string from the registry
$uninstallString = (Get-ItemProperty -Path $registryPath).UninstallString
# Execute the uninstallation command
$arguments = "/C `"$uninstallString`" /quiet"
Start-Process -FilePath cmd.exe -ArgumentList $arguments -Wait
Write-Host "Microsoft Visual C++ 2005 uninstalled successfully."
} else {
Write-Host "Microsoft Visual C++ 2005 is not installed."
}
}
# Check and uninstall x86 version
Uninstall-Program -registryPath $x86RegistryPath
The following Registry paths can be used for the uninstallation of Visual C++
Visual Studio C++ 2005 x64
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{ad8a2fa1-06e7-4b0d-927d-6e54b3d31028}
Visual Studio C++ 2005 x86
HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{710f4c1c-cc18-4c49-8cbf-51240c89a1a2}
Visual Studio C++ 2008 x64 9.0.30729.6161
SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4}
Visual Studio C++ 2008 x86 9.0.30729.6161
SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{9BE518E6-ECC6-35A9-88E4-87755C07200F}
Visual Studio C++ 2008 x64 9.0.30729.17
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{8220EEFE-38CD-377E-8595-13398D740ACE}
Visual Studio C++ 2008 x86 9.0.30729.17
HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{9A25302D-30C0-39D9-BD6F-21E6EC160475}
Visual Studio C++ 2010 x64
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{1D8E6291-B0D5-35EC-8441-6616F567A0F7}
Visual Studio C++ 2010 x86
HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}
If you liked this post, learned some new things or this article helped you out please think about giving a one time donation at the Donation Page to keep the site online!
Leave a comment