Close

May 1, 2017

Install-VisualCRedistributables.ps1 – A Visual C++ Redistributable Installer

Microsoft Visual C++ Redistributable 2005-2015 installed

In updating my MDT deployment shares recently, I got tired of having to do something about the Visual C++ Redistributable installers and finally decided to do something about it, so I’ve written a script that will download the installers and optionally install them – Install-VisualCRedistributables.ps1.

This script reads an external XML file that contains the installer information for each of the Visual C++ Redistributables, so that changes to URLs, install options and new redistributables can be made without making changes to the script. The XML file lists the download URL and install instructions for each installer and looks like this:

The script will install the redistributables in the order listed in the XML file thus ensuring they are installed in the correct order.

Using Install-VisualCRedistributables.ps1

Download Install-VisualCRedistributables.ps1 and VisualCRedistributablesSupported.xml from the repository and edit the XML as required. As this includes all supported redistributables from 2008 to 2017, all will be downloaded and installed by default. If you don’t need all of them in your environment, remove those that aren’t required.

The script can be run in two phases – one to download the installers and again to install the redistributables – this is useful for downloading the installers to add to your reference image via MDT, for example. The script can also be used to download and install in one action.

Parameters

The parameters for the script are:

Xml

This points to the XML file that contains the details about the Visual C++ Redistributables. This must be in the expected format, otherwise the script will fail.

Example – Downloads the Visual C++ Redistributables listed in VisualCRedistributables.xml.

Path

Specify a target folder to download the Redistributables to, otherwise use the current folder.

Example – Downloads the Visual C++ Redistributables listed in VisualCRedistributables.xml to C:\Redist.

Install

By default the script will only download the Redistributables. This allows you to download the Redistributables for seperate deployment (e.g. in a reference image). Add -Install to install each of the Redistributables as well.

Example – Downloads and installs the Visual C++ Redistributables listed in VisualCRedistributables.xml.

Results

Here is an example of the end result with the Redistributables installed. Note that 2015 and 2017 are the same major version (14.x), so once 2017 is installed, 2015 will not be displayed in the programs list. 2005 are not installed by default, as these are no longer supported.

Microsoft Visual C++ Redistributable 2005-2015 installed

Microsoft Visual C++ Redistributables

Finally

This is the first version of the script and to the best of my knowledge the XML file is correct. Feedback and corrections is welcome and I have some plans to update the script with some additional error checking.

6 Comments on “Install-VisualCRedistributables.ps1 – A Visual C++ Redistributable Installer

Simon
May 1, 2017 at 10:32 pm

Hi Aaron,

Great work on this – really handy script to have!

Worked perfectly with one minor issue noted below

in your examples above you are using -xml… this does not appear to be a supported parameter of the script, -File seems to do the trick for me.

Thanks.

Reply
Aaron Parker
May 2, 2017 at 9:03 pm

Thanks. Great to hear. I’m changing -File to -Xml in the next update

Reply
NIGHTCD
May 4, 2017 at 4:01 pm

is there any posibility to cleanup the C: afer installation ?

Reply
Aaron Parker
August 16, 2017 at 11:51 pm

The versions of the redistributables that were causing this have been removed from VisualCRedistributablesSupported.xml

Reply
Jack
August 15, 2017 at 6:58 pm

Any chance of the download links being fixed? 🙂

Reply
Aaron Parker
August 16, 2017 at 11:51 pm

Fixed.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *