Worklet for VB redistributables installation

Evaluation code

$regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\{050d4fc8-5d48-4b8f-8972-47c82c46020f}"
$name = "Version"
Get-ItemProperty -Path "$regkey" -Name "$name" -ErrorAction SilentlyContinue
    	If (($exists -ne $null) -and ($exists.Length -ne 0)) {
        	Exit 0
    	}  else { Exit 1 }

Remediation code

#Set download URLs for the various installers
$vcredist_08 = "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe"
$vcredist_10 = "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe"
$vcredist_12 = "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe"
$vcredist_13 = "https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe"
$vcredist_1519 = "https://aka.ms/vs/16/release/vc_redist.x64.exe"

#Download the installers
Invoke-WebRequest $vcredist_08 -OutFile $env:temp\vcredist_08.exe
Invoke-WebRequest $vcredist_10 -OutFile $env:temp\vcredist_10.exe
Invoke-WebRequest $vcredist_12 -OutFile $env:temp\vcredist_12.exe
Invoke-WebRequest $vcredist_13 -OutFile $env:temp\vcredist_13.exe
Invoke-WebRequest $vcredist_1519 -OutFile $env:temp\vcredist_1519.exe

#Install them All
Start-Process $env:temp\vcredist_08.exe -ArgumentList "/Q"
Start-Process $env:temp\vcredist_10.exe -ArgumentList "/quiet /norestart"
Start-Process $env:temp\vcredist_12.exe -ArgumentList "/install /quiet /norestart"
Start-Process $env:temp\vcredist_13.exe -ArgumentList "/install /quiet /norestart"
Start-Process $env:temp\vcredist_1519.exe -ArgumentList "/install /quiet /norestart"
1 Like

If you ever run into an issue where the Invoke-WebRequest does not complete the download, try adding a “-UseBasicParsing” switch after Invoke-WebRequest.

1 Like