This approach has now been replaced with the VcRedist PowerShell module. For more information on VcRedist, see the VcRedist docs.
I recently posted an article on a script I’ve written for downloading and installing the Microsoft Visual C++ Redistributables. Thanks to Cornelius Schuchardt, the script now supports creating applications for each redistributable in Configuration Manager (ConfigMgr).
Install-VisualCRedistributables.ps1 has been updated to version 1.1, which you can download from the releases page and includes the following updates:
- VisualCRedistributables.xml updated with MSI Product codes for the redistributables
- Install-VisualCRedistributables.ps1 updated with ConfigMgr support - create applications for the redistributables in ConfigMgr
- Updated with additional parameter validation, parameter sets, inline comments
This script will download the Visual C++ Redistributables listed in an external XML file into a folder structure that represents major release, processor architecture and update release (e.g. SP1, MFC, ATL etc.). The script defines the available redistributables and can be updated with each release with no changes made to the script.
The basic structure of the XML file should be as follows (an XSD schema is included in the repository):
<Redistributables> <Platform Architecture="x64" Release="" Install=""> <Redistributable> <Name></Name> <ShortName></ShortName> <URL></URL> <ProductCode></ProductCode> <Download></Download> </Redistributable> </Platform> <Platform Architecture="x86" Release="" Install=""> <Redistributable> <Name></Name> <ShortName></ShortName> <URL></URL> <ProductCode></ProductCode> <Download></Download> </Redistributable> </Platform> </Redistributables>
Each major version of the redistributables is grouped by that defines the major release, processor architecture and install arguments passed to the installer.
The properties of each redistributable are defined in each node:
- Name - the name of the redistributable as displayed on the download page. Not used in the script, but useful for reading the XML file.
- ShortName - the redistributable will be downloaded to Release\Architecture\ShortName
- URL - this is the URL to the page at microsoft.com/downloads. Not used in the script, but useful for referencing the download as needed
- ProductCode - this is the MSI Product Code for the specified VC++ App that will be used to import the package into Configuration Manager
- Download - this is the URL to the installer so that the script can download each redistributable
The script supports the -WhatIf and -Verbose parameters for testing and verbose output when using the parameter actions below.
There are 3 parameter sets that control the following actions:
- Download only
- Download and Install the redistributable to the current machine
- Download and create ConfigMgr applications for the redistributables
The XML file that contains the details about the Visual C++ Redistributables. This must be in the expected format. If the redistributable exists in the target location, it will be skipped and not re-downloaded.
Example: download the Visual C++ Redistributables listed in VisualCRedistributables.xml to the current folder.
.\Install-VisualCRedistributables.ps1 -Xml ".\VisualCRedistributables.xml" -Path .\
Specify a target folder to download the Redistributables to, otherwise use the current folder will be used.
Example: download the Visual C++ Redistributables listed in VisualCRedistributables.xml to C:\Redist.
.\Install-VisualCRedistributables.ps1 -Xml ".\VisualCRedistributables.xml" -Path C:\Redist -Install
To install the redistributables add the -Install parameter.
By default, the script will only download the Redistributables. This allows you to download the Redistributables for separate deployment (e.g. in a reference image). Add -Install to install each of the Redistributables as well.
Example: download (to the current folder) and install the Visual C++ Redistributables listed in VisualCRedistributables.xml.
.\Install-VisualCRedistributables.ps1 -Xml ".\VisualCRedistributables.xml" -Install
The Redistributables will installed in the order specified in the XML file.
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.
Visual C++ Redistributables 2005 to 2017 (including 2015) installed:
Support for downloading the Redistributables and creating applications in System Center Configuration Manager has recently been added.
If specified, enables automatic creation of Application Containers in Configuration Manager with a single Deployment Type containing the downloaded EXE file. The script must be run from a machine with the Configuration Manager console and the ConfigMgr PowerShell module installed.
Specify SMS Site Code for the ConfigMgr app creation.
Example: Download Visual C++ Redistributables listed in VisualCRedistributables.xml and create ConfigMgr Applications for the selected Site.
.\Install-VisualCRedistributables.ps1 -Xml ".\VisualCRedistributables.xml" -Path \\server1.contoso.com\Sources\Apps\VSRedist -CreateCMApp -SMSSiteCode S01
This will look similar to the following in the Configuration Manager console:
Work is proceeding on additional updates including the following:
- Provide arguments for specifying processor architectures (x86, x64) and platforms (2005, 2012, 2017, etc.) to enable only those specified for download, install etc. without having to modify the XML file
- Add software versions for import into ConfigMgr applications
- Specify a folder for creating the ConfigMgr applications in. Currently, applications are created in the top level Applications node
Feedback and bug reports welcome.