Schriftgröße: +
2 minutes reading time (376 words)

Automatic Download and Install all Visual C++ Runtimes

Powershell Switch 180x180Here 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 All VisualCRuntimes

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
	
	
}

 

Erstellung langjähriger Zertifikate zur Nutzung mi...
Übersicht der Neuerungen von App-V 5.0 bis 5.1 übe...

Ähnliche Beiträge

 

Kommentare 7

Gäste - seb am Freitag, 01. April 2016 21:11

nice script thanks for sharing! what happen when you run it on a x86 machine? it looks like it will try to install x64 runtime anyway am I wrong?
thanks

nice script thanks for sharing! what happen when you run it on a x86 machine? it looks like it will try to install x64 runtime anyway am I wrong? thanks
Gäste - V am Mittwoch, 31. August 2016 12:58

Thank you my German Commraden! I was too lazy to install these piece by piece myself, so your script came in handy and proved to be very useful!!

Thank you my German Commraden! I was too lazy to install these piece by piece myself, so your script came in handy and proved to be very useful!!
Gäste - Spy am Donnerstag, 01. September 2016 04:01

Thanks a ton, saved me loads of time!

Thanks a ton, saved me loads of time!
Gäste - Asdf am Sonntag, 30. Oktober 2016 23:28

Thank you very much for uploading this script, managed to save me a lot of time, danke

Thank you very much for uploading this script, managed to save me a lot of time, danke
Gäste - Brian am Freitag, 13. Januar 2017 19:20

It works, but I'm not a fan of the hard-coded URL's. Microsoft's landing page to download the restrib (e.g., for 2010 x64, https://www.microsoft.com/en-us/download/details.aspx?id=14632) provides a "Download" button that dynamically points to the latest version of that runtime. You'll find the download link it points to now is different than the URL hard-coded in your code.

Something like this would be more dynamic. All you need to know is the "id"

if (! (Test-Path "$outputPath\VS2010" -PathType Container)) { New-Item "$outputPath\VS2010" -Type Directory -Force }

Write-Verbose "Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)" -Verbose
$doc = Invoke-WebRequest "https://www.microsoft.com/en-us/download/confirmation.aspx?id=8328"
$url = ($doc.Links | ? {$_.OuterHTML -match 'http://download.microsoft.com/download'}).href
$fileName = Split-Path $url -leaf
Invoke-WebRequest "$url" -OutFile "$outputPath\VS2010\$fileName"

Write-Verbose "Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)" -Verbose
$doc = Invoke-WebRequest "https://www.microsoft.com/en-us/download/confirmation.aspx?id=13523"
$url = ($doc.Links | ? {$_.OuterHTML -match 'http://download.microsoft.com/download'}).href
$fileName = Split-Path $url -leaf
Invoke-WebRequest "$url" -OutFile "$outputPath\VS2010\$fileName"

It works, but I'm not a fan of the hard-coded URL's. Microsoft's landing page to download the restrib ([i]e.g.[/i], for 2010 x64, https://www.microsoft.com/en-us/download/details.aspx?id=14632) provides a "Download" button that dynamically points to the latest version of that runtime. You'll find the download link it points to now is different than the URL hard-coded in your code. Something like this would be more dynamic. All you need to know is the "id" if (! (Test-Path "$outputPath\VS2010" -PathType Container)) { New-Item "$outputPath\VS2010" -Type Directory -Force } Write-Verbose "Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)" -Verbose $doc = Invoke-WebRequest "https://www.microsoft.com/en-us/download/confirmation.aspx?id=8328" $url = ($doc.Links | ? {$_.OuterHTML -match 'download.microsoft.com/download'}).href $fileName = Split-Path $url -leaf Invoke-WebRequest "$url" -OutFile "$outputPath\VS2010\$fileName" Write-Verbose "Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)" -Verbose $doc = Invoke-WebRequest "https://www.microsoft.com/en-us/download/confirmation.aspx?id=13523" $url = ($doc.Links | ? {$_.OuterHTML -match 'download.microsoft.com/download'}).href $fileName = Split-Path $url -leaf Invoke-WebRequest "$url" -OutFile "$outputPath\VS2010\$fileName"
Andreas Nick am Freitag, 13. Januar 2017 20:06

Hi Brian, good idea, I will rework the script

Hi Brian, good idea, I will rework the script
Gäste - Dweia am Donnerstag, 07. März 2019 14:43

Because it took me quite some time to figure out the details, I post here my extension to the suggestion of "Brian" from 2017/01/13. The Version posted there doesn't work any more out of the box, since Microsoft changed their forms and the newer Redistributables use one common id for both x86 and x64 and arm...

My version only includes 2010, 2013 and 2015 because those are the ones I needed right now:

#################################################################
$outputPath = ".\VCRuntime"
if (! (test-path "$outputPath\VS2010")) { New-Item "$outputPath\VS2010" -Type directory -Force }
if (! (test-path "$outputPath\VS2013")) { New-Item "$outputPath\VS2013" -Type directory -Force }
if (! (test-path "$outputPath\VS2015")) { New-Item "$outputPath\VS2015" -Type directory -Force }
$progressPreference = 'silentlyContinue'

Write-Verbose "Microsoft Visual C++ 2010 Redistributable Package" -Verbose
$doc = Invoke-WebRequest "https://www.microsoft.com/en-US/download/confirmation.aspx?id=14632" -UseBasicParsing
$url = ($doc.Links | ? {$_.OuterHTML -match 'vcredist_x'}).href
$dlPath = (Split-Path $url |Select-Object -First 1) -replace "\\","/"
$filenames = (Split-Path $url -leaf|sort -Unique)
foreach ($vcFile in $filenames)
{
Write-Host "Download VC 2010: " $vcFile
Invoke-WebRequest "$dlPath/$vcFile" -OutFile "$outputPath\VS2010\$vcFile"
}

Write-Verbose "Microsoft Visual C++ 2013 Redistributable Package" -Verbose
$doc = Invoke-WebRequest "https://www.microsoft.com/en-US/download/confirmation.aspx?id=40784" -UseBasicParsing
$url = ($doc.Links | ? {$_.OuterHTML -match "vcredist_x}).href
$dlPath = (Split-Path $url |Select-Object -First 1) -replace "\\","/"
$filenames = (Split-Path $url -leaf|sort -Unique)
foreach ($vcFile in $filenames)
{
Write-Host "Download VC 2013: " $vcFile
Invoke-WebRequest "$dlPath/$vcFile" -OutFile "$outputPath\VS2013\$vcFile"
}

Write-Verbose "Microsoft Visual C++ 2015 Redistributable Package" -Verbose
$doc = Invoke-WebRequest "https://www.microsoft.com/en-US/download/confirmation.aspx?id=48145" -UseBasicParsing
$url = ($doc.Links | ? {$_.OuterHTML -match 'vc_redist.x'}).href
$dlPath = (Split-Path $url |Select-Object -First 1) -replace "\\","/"
$filenames = (Split-Path $url -leaf|sort -Unique)
foreach ($vcFile in $filenames)
{
Write-Host "Download VC 2015: " $vcFile
Invoke-WebRequest "$dlPath/$vcFile" -OutFile "$outputPath\VS2015\$vcFile"
}
#################################################################

Hope it helps somebody

Because it took me quite some time to figure out the details, I post here my extension to the suggestion of "Brian" from 2017/01/13. The Version posted there doesn't work any more out of the box, since Microsoft changed their forms and the newer Redistributables use one common id for both x86 and x64 and arm... My version only includes 2010, 2013 and 2015 because those are the ones I needed right now: ################################################################# $outputPath = ".\VCRuntime" if (! (test-path "$outputPath\VS2010")) { New-Item "$outputPath\VS2010" -Type directory -Force } if (! (test-path "$outputPath\VS2013")) { New-Item "$outputPath\VS2013" -Type directory -Force } if (! (test-path "$outputPath\VS2015")) { New-Item "$outputPath\VS2015" -Type directory -Force } $progressPreference = 'silentlyContinue' Write-Verbose "Microsoft Visual C++ 2010 Redistributable Package" -Verbose $doc = Invoke-WebRequest "https://www.microsoft.com/en-US/download/confirmation.aspx?id=14632" -UseBasicParsing $url = ($doc.Links | ? {$_.OuterHTML -match 'vcredist_x'}).href $dlPath = (Split-Path $url |Select-Object -First 1) -replace "\\","/" $filenames = (Split-Path $url -leaf|sort -Unique) foreach ($vcFile in $filenames) { Write-Host "Download VC 2010: " $vcFile Invoke-WebRequest "$dlPath/$vcFile" -OutFile "$outputPath\VS2010\$vcFile" } Write-Verbose "Microsoft Visual C++ 2013 Redistributable Package" -Verbose $doc = Invoke-WebRequest "https://www.microsoft.com/en-US/download/confirmation.aspx?id=40784" -UseBasicParsing $url = ($doc.Links | ? {$_.OuterHTML -match "vcredist_x}).href $dlPath = (Split-Path $url |Select-Object -First 1) -replace "\\","/" $filenames = (Split-Path $url -leaf|sort -Unique) foreach ($vcFile in $filenames) { Write-Host "Download VC 2013: " $vcFile Invoke-WebRequest "$dlPath/$vcFile" -OutFile "$outputPath\VS2013\$vcFile" } Write-Verbose "Microsoft Visual C++ 2015 Redistributable Package" -Verbose $doc = Invoke-WebRequest "https://www.microsoft.com/en-US/download/confirmation.aspx?id=48145" -UseBasicParsing $url = ($doc.Links | ? {$_.OuterHTML -match 'vc_redist.x'}).href $dlPath = (Split-Path $url |Select-Object -First 1) -replace "\\","/" $filenames = (Split-Path $url -leaf|sort -Unique) foreach ($vcFile in $filenames) { Write-Host "Download VC 2015: " $vcFile Invoke-WebRequest "$dlPath/$vcFile" -OutFile "$outputPath\VS2015\$vcFile" } ################################################################# Hope it helps somebody
Bereits registriert? Hier einloggen
Samstag, 21. Dezember 2024

Sicherheitscode (Captcha)

Nick Informationstechnik GmbH
Dribusch 2
30539 Hannover

+49 (0) 511 165 810 190
+49 (0) 511 165 810 199

infonick-it.de

Newsletter

Anmeldung zum deutschen M.A.D. Newsletter mit Informationen zur Anwendungsvirtualisierung!

Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell für den Betrieb der Seite, während andere uns helfen, diese Website und die Nutzererfahrung zu verbessern (Tracking Cookies). Sie können selbst entscheiden, ob Sie die Cookies zulassen möchten. Bitte beachten Sie, dass bei einer Ablehnung womöglich nicht mehr alle Funktionalitäten der Seite zur Verfügung stehen.