By Andreas Nick on Samstag, 02. Januar 2016
Category: Powershell

Automatic Download and Install all Visual C++ Runtimes

Here are two simple Powershell scripts to automatic download and install all Visual C++ Runtimes for X86 and X64 Systems (2005, 2008, 2010, 2012, 2013, 2015).

Download the Visual C++ Runtime Modules:

<#
	.SYNOPSIS
		Download all "english" Visual C++ Runtimes
	.PARAMETER  ParameterA
		$OutputPath = Default Path
	.LINK
		http://www.software-virtualisierung.de
#>
param(
	[String]$outputPath = ".\VCRuntime"
)
Write-Host "Download Microsoft Visual C++ 2005, 2008, 2010, 2012, 2013, 2015"
Write-Host "Andreas Nick, Software-Virtualisierung.de, 2015"
if(! (test-path "$outputPath\VS2005X86SP1")) { New-Item "$outputPath\VS2005" -Type directory -Force}
Write-Verbose "Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)" -Verbose
Invoke-WebRequest   "http://download.microsoft.com/download/8/B/4/8B42259F-5D70-43F4-AC2E-4B208FD8D66A/vcredist_x86.EXE" -OutFile "$outputPath\VS2005\vcredist_x86.exe"
Write-Verbose "Microsoft Visual C++ 2005 SP1 Redistributable Package (x64)" -Verbose
Invoke-WebRequest  "http://download.microsoft.com/download/8/B/4/8B42259F-5D70-43F4-AC2E-4B208FD8D66A/vcredist_x64.EXE" -OutFile "$outputPath\VS2005\vcredist_x64.exe"
if (! (test-path "$outputPath\VS2008")) { New-Item "$outputPath\VS2008" -Type directory -Force }
Write-Verbose "Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)" -Verbose
Invoke-WebRequest  "http://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe" -OutFile "$outputPath\VS2008\vcredist_x86.exe"
Write-Verbose "Microsoft Visual C++ 2008 SP1 Redistributable Package (x64)" -Verbose
Invoke-WebRequest  "http://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe" -OutFile "$outputPath\VS2008\vcredist_x64.exe"
if (! (test-path "$outputPath\VS2010")) { New-Item "$outputPath\VS2010" -Type directory -Force }
Write-Verbose "Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)" -Verbose
Invoke-WebRequest "http://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe" -OutFile "$outputPath\VS2010\vcredist_x86.exe"
Write-Verbose "Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)" -Verbose
Invoke-WebRequest "http://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe" -OutFile "$outputPath\VS2010\vcredist_x64.exe"
if (! (test-path "$outputPath\VS2012")) { New-Item "$outputPath\VS2012" -Type directory -Force }
Write-Verbose "Microsoft Visual C++ 2012 Update 4 Redistributable Package (x86)" -Verbose
Invoke-WebRequest "http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe" -OutFile "$outputPath\VS2012\vcredist_x86.exe"
Write-Verbose "Microsoft Visual C++ 2012 Update 4 Redistributable Package (x64)" -Verbose
Invoke-WebRequest "http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe" -OutFile "$outputPath\VS2012\vcredist_x64.exe"
if (! (test-path "$outputPath\VS2013")) { New-Item "$outputPath\VS2013" -Type directory -Force }
Write-Verbose "Microsoft Visual C++ 2013 Redistributable Package (x86)" -Verbose
Invoke-WebRequest "http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe" -OutFile "$outputPath\VS2013\vcredist_x86.exe"
Write-Verbose "Microsoft Visual C++ 2013 Redistributable Package (x64)" -Verbose
Invoke-WebRequest "http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe" -OutFile "$outputPath\VS2013\vcredist_x64.exe"
if (! (test-path "$outputPath\VS2015")) { New-Item "$outputPath\VS2015" -Type directory -Force }
Write-Verbose "Visual C++ Redistributable for Visual Studio 2015 (x86)" -Verbose
Invoke-WebRequest "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe" -OutFile "$outputPath\VS2015\vcredist_x86.exe"
Write-Verbose "Visual C++ Redistributable for Visual Studio 2015 (x64)" -Verbose
Invoke-WebRequest "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe" -OutFile "$outputPath\VS2015\vcredist_x64.exe"

Install all Visual C++ Runtime Modules (run as Administrator)

<#
	.SYNOPSIS
		Install all "english" Visual C++ Runtimes

	.PARAMETER  ParameterA
		$OutputPath = Default Path

	.LINK
		http://www.software-virtualisierung.de

#>


param(
	[String]$outputPath = ".\VCRuntime"
)

[String]$outputPath = ".\VCRuntime"

Write-Host "Install Microsoft Visual C++ 2005, 2008, 2010, 2012, 2013, 2015"
Write-Host "Andreas Nick, Software-Virtualisierung.de, 2015"

foreach ($vcFile in Get-ChildItem $outputPath -Recurse -Filter "*.exe")
{
	Write-Host "Install " $vcFile.fullname
	Start-Process  $vcFile.fullname -ArgumentList '/q' -NoNewWindow -Wait
	
	
}

Related Posts

Leave Comments