Mailbag: How to perform a silent install of the Visual C++ 2010 redistributable packages
Question:
You previously posted lists of command line switches to perform silent and unattended installations of the Visual C++ 2005 redistributable and the Visual C++ 2008 redistributable. How can I perform silent and unattended installations of the Visual C++ 2010 redistributable?
Answer:
The Visual C++ 2010 redistributable packages (vcredist_x86.exe, vcredist_x64.exe and vcredist_ia64.exe) support the following command line installation options.
The examples below use the file named vcredist_x86.exe, but you can substitute the x64 or ia64 versions of the EXEs with equivalent command lines to achieve the same behavior for them as well.
Silent install
This option will suppress all UI and perform an install.
<full path>\vcredist_x86.exe /q /norestart
For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:
c:\vc2010redist\vcredist_x86.exe /q /norestart
Unattended install
This option will display a progress dialog (but requires no user interaction) and perform an install.
<full path>\vcredist_x86.exe /passive /norestart
For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:
c:\vc2010redist\vcredist_x86.exe /passive /norestart
Silent repair
This option will suppress all UI and perform a repair.
<full path>\vcredist_x86.exe /q /repair /norestart
For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:
c:\vc2010redist\vcredist_x86.exe /q /repair /norestart
Silent uninstall
This option will suppress all UI and perform an uninstall.
<full path>\vcredist_x86.exe /q /uninstall /norestart
For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:
c:\vc2010redist\vcredist_x86.exe /q /uninstall /norestart
A note about reboots
All of the examples above use the /norestart switch to suppress reboots after the setup process completes. The /norestart switch does not eliminate the need to reboot entirely – it just gives the calling process control over when to schedule the reboot if one is needed due to files being in use during setup. If you run the Visual C++ 2010 redistributable setup and use the /norestart switch, you must check the exit code returned by the setup process and handle it accordingly in the calling process. Here are the possible exit codes:
- Exit code 0 means that setup succeeded and no reboot is needed.
- Exit code 3010 means that setup succeeded and a reboot is needed to complete installation.
- Any other exit code means that setup failed.
Related link
Comments
Anonymous
October 20, 2010
Thanks for posting this, useful information. On the other hand, if you have the right connections, please let the build engineers know about the idea that the following naming convention might not be the best one: name of vc++ 2005 redist package: vcredist_x86.exe; name of vc++ 2008 redist package: vcredist_x86.exe; name of vc++ 2010 redist package: vcredist_x86.exe.Anonymous
October 20, 2010
Hi Daniel Szabo - I'm not sure I understand your feedback. Are you suggesting that each version should have a unique name or something like that (vc2005redist_x86.exe, vc2008redist_x86.exe, etc)? I think the best way to provide that type of feedback would be for you to post a suggestion on the Connect site at connect.microsoft.com/visualstudio.Anonymous
October 20, 2010
Hi! Thanks for the link (and yes, unique naming for each release would be great). I will try contacting them (I have other exotic questions to them like why don't they manage to put each new vc++ library into the windows update system but you're right - this has nothing to do with you) Keep up the good posts!Anonymous
October 20, 2010
Why should they? VS is not part of windows. Next thing you know Borland/"whatever they are called today" want their runtimes on windows updateAnonymous
January 30, 2011
Thanks Aaron for providing usefull info for installing VC++ 2010, Do we require windows installer for installing redistributable?. In the project currently I'm working it installs Windows Installer for installing VC++ 2005 redistributable. I'm not sure for installing VC++ 2010 redistributable MSI requires or not.Anonymous
January 31, 2011
Hi Madhur - All versions of the Visual C++ Redistributable are packaged as .msi files, so they all require a version of Windows Installer in order to be able to install successfully. The VC++ 2010 Redistributable requires at least Windows Installer 2.0, and that comes as a part of Windows on each of the versions of Windows that the VC++ 2010 Redistributable supports. As a result, you don't need to worry about installing Windows Installer before trying to install the VC++ 2010 Redistributable.Anonymous
February 01, 2011
Thanks Aaron!! Actually when we were installing VC8 redistributable that time we installed windows installer 3.1. So as per your suggestion we don't have to worry regarding installer.Anonymous
February 10, 2011
Hi Aaron, Can we know programmatically which specific version of redistributables is used? I mean suppose VC10 RTLs releases a new version in future then how can we read, because "Installed" DWORD under \Software\Microsoft\VisualStudio\10.0\VC\VCRedist\x86 gives whether VC10 Redistributables are installed or not; but not give specific version. Any help is appreciable.Anonymous
February 11, 2011
Hi Madhur - There is a Version value under that registry sub-key, and it has different values for the original release of the Visual C++ Redistributable and for the SP1 beta that is currently available. You would have to create a custom action to parse this Version registry value though, so if your application requires a specific version of the redistributable, it might be best to check for the install state of that exact redistributable MSI instead of relying on this registry key. You can do that by using Windows Installer APIs or by checking for the product code under HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionUninstall{productcode}.Anonymous
February 16, 2011
The comment has been removedAnonymous
February 16, 2011
Hi Aaron, I've verified it is making entry in registry at \Software\Microsoft\VisualStudio\10.0\VC\VCRedist\x86 at PC that does not have VS 2010, so it can be used but as per your suggession I can read particular .msi file from HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionUninstall{productcode}, I'll try this one and check whether up to what extent it can give information e.g. version, which service pack etc.. Thanks Aaron for your all around helpAnonymous
February 16, 2011
Hi Madhur - I'm sorry I provided incorrect information earlier about the version of Windows Installer that is required by the VC++ redistributable. I looked at the schema in the MSI in Orca, and it says 200, but I didn't look at what the setup bootstrapper is checking for. You will need to make sure that Windows Installer 3.1 or higher is installed on any computers that you install the VC++ 2010 Redistributable on. The VC++ 2010 runtime files install to the system directory (instead of to the WinSxS directory used by previous versions of the VC++ runtime files). As a result, if you're going to perform a file version check, you'll need to check in the system directory. The registry-based check for the redistributable MSI should also work in this type of scenario if you'd prefer.Anonymous
February 17, 2011
Hi Aaron, No probs for installer and no need to feel sorry..How can we verify whether Visual C++ 2010 Redistributable supports Side by Side installation (i.e. multiple versions exist)Anonymous
February 17, 2011
Hi Madhur - I'm not sure about this side-by-side question yet. For now, you can try to examine the VC++ 2010 SP1 beta redistributable that is available at www.microsoft.com/.../details.aspx and see if it supports side-by-side installation with the original version of the VC++ 2010 redistributable. Keep in mind that this is a beta though, so the behavior you see may not be the same in the final SP1 release.Anonymous
February 17, 2011
Thanks Aaron for quick response..I mean for side by side installation in VCRT8 it was creating separate folders for each version and keeping dll inside that, but in VCRT10 if it is copying System 32 folder but I've just tried with VCRT10 SP1 Beta installation and it has overridden earlier installation so it is not keeping both versions. As my application is to move VC8 to VC10 and dotnet 2.0 to 4.0 so need to maintain side by side functionality by installing multiple versions. The registry-based check for the redistributable MSI should also work in this type of scenario - Can you please litte explore or give me link where I can see some sample code for this?Anonymous
February 18, 2011
Hi Madhur - Because the VC++ 2010 runtime files install to system32, the various service packs cannot install to side-by-side locations like the older versions did when they installed to sub-folders under WinSxS. If your application requires the VC++ 2010 files but the exact build number doesn't matter, you can detect the install state by using the registry key at HKEY_LOCAL_MACHINESoftwareMicrosoftVisualStudio10.0VCVCRedistx86. If your applicatoin requires an exact build number of the VC++ 2010 files, you will likely need to do file version checks on the files in system32.Anonymous
February 19, 2011
Thanks Aaron!! When I'm trying to use MsiQueryProductState("{196BB40D-1578-3D01-B289-BEFC77A11A1E}") getting linking error LNK2001: unresolved external symbol _MsiQueryProductStateA@4 and fatal error LNK1120: 1 unresolved externals
#include <windows.h> #include <stdio.h> #include <msi.h> void main() { int status = MsiQueryProductState("{196BB40D-1578-3D01-B289-BEFC77A11A1E}"); } Not sure why this linking error is appearing.
Anonymous
February 20, 2011
Hi Madhur - I think you'll need to add msi.lib to the list of libraries you link against in your project to resolve this error.Anonymous
February 20, 2011
Thanks Aaron for your quick help!! It resolved by adding msi.lib I believe this product id will be separate for each version/patch of VC10 Redistributables. So that I can check specific version of RTL. Please correct me if I'm assuming incorrectly.Anonymous
February 20, 2011
Hi Madhur - You'll need to be careful about using the product code for detection. It looks to me like the SP1 MSI will do a major upgrade of the RTM MSI. That means that if you install SP1 on a computer that has RTM, it will automatically uninstall the RTM MSI behind the scenes during SP1 setup. If your application setup is checking for the RTM product code, but the machine already has SP1, it will return the incorrect result. Also, if your application setup tries to install the RTM MSI in this scenario, the RTM MSI will fail because a newer version is already installed.Anonymous
February 20, 2011
Hi Aaron, For Visual C++ 2010 SP1 Beta Redistributable Package (x86), I'm getting Family Id i.e. 6201A933-4806-4036-8895-A340D7BEBF10, but not able to locate Product Id. I tried from microsoft site but could not get. I believe Product Id and Family Id are different. Is there any way to get product id for VCRT10 SP1 Beta?Anonymous
February 20, 2011
Yes Aaron!! I agree with you. when I installed VCRT10 SP1 Beta then behind the scene it has uninstalled main version of VCRT10. When I tried to install VCRT10 again then it gave message that it already has higher version installed. This means VCRT10 is not going to support Side by Side installation because newer version is replacing older one.Anonymous
February 21, 2011
Hi Madhur - The family ID is only used by the Microsoft Download Center when it hosts files. You can find the product code by opening the MSI in Orca (msdn.microsoft.com/.../aa370557.aspx). For the VC++ 2010 SP1 beta, the product code is {58D8485F-FEB8-32AB-9A3D-6AD6C6E78F40}. Correct, the VC++ 2010 Redistributable SP1 MSI doesn't support side-by-side install with the RTM MSI, but the payload installed by the SP1 MSI should be backwards compatible so that if you have SP1 installed, you can run applications built with RTM or SP1.Anonymous
February 21, 2011
Thanks Aaron!! So There are two ways to check particular version is installed or not. First, check through Product Id using MsiQueryProductState API and second is using File version of any redistributable file e.g. ATL100.dll. Using product code may have access right issue. I'm not sure which way is better in less maintenance wise. Please guide.Anonymous
February 21, 2011
Hi Madhur - I'd suggest using a registry check or a file version check. The product code check will not end up being reliable because newer service packs perform major upgrades of older service packs.Anonymous
February 21, 2011
Thanks Aaron!! So If I'll use registry check then I need to again use product code from HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionUninstall{productcode}, but as per your suggestion product code is not reliable and if I use file version check then I need to hard code so much code for comparing then i need to change again and again.Anonymous
February 22, 2011
Hi Madhur - For the registry check, I was thinking you should use a key that exists in the RTM version and in the SP1 version, like this: [HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio10.0VCVCRedistx86] Installed = 1 (REG_DWORD) You shouldn't use a registry key that depends on the product code because you'll run into the same potential set of issues that you'd run into if you tried to check the install state of the product code directly with MsiQueryProductState. If you use a file version check, you shouldn't need to hard-code much. You should verify that the file exists and check for a major version that is at least 10 and that should be all you need.Anonymous
March 16, 2011
Thanks Aaron!! I struk in an another issue. When I'm compiling VS2005 C++ project in VS2010 then encountering MIDL 2400/2401 warnings. I tried to search but could not get sure shot answer. Solution: If we remove optional attribute then warnings may go off but not sure how much it is reliable. I mean it should not break functionality.Anonymous
March 16, 2011
Hi Madhur - I'm not sure I understand the issue that you're describing. Are you trying to upgrade a Visual C++ 2005 project and then build it in Visual C++ 2010? If so, then solving this type of warnings is not really in my areas of expertise, and I'd suggest posting a question on one of the Visual C++ forums at social.msdn.microsoft.com/.../visualc.Anonymous
April 11, 2011
Which version of the redistributable (i.e. x86 or x64) is required to run 32-bit applications on a 64-bit OS? Does this depend on the OS (the .NET way) or on the applications to be executed (the VS2008 way)?Anonymous
April 14, 2011
Hi Ole - You will need the x86 redistributable in order to be able to run 32-bit applications, regardless of what OS you run them on.Anonymous
July 13, 2011
Hi Aaron, Thanks for the great info. What's the difference in running the exe in silent mode in 'repair' mode (<full path>vcredist_x86.exe /q /repair /norestart ) or running it in simply 'install' mode even in case when it is already installed? Would it make any difference? Is the exe intelligent enough to fall back to 'repair' automatically in case it finds VCredist already installed, but the repair option is not specifically specified?Anonymous
July 14, 2011
The comment has been removedAnonymous
July 14, 2011
The comment has been removedAnonymous
July 15, 2011
Hi Michel - The verbose MSI log file should show why that file is not being restored. Do you have a copy of a verbose MSI log file from this scenario that you could upload to a file server (such as http://skydrive.live.com) and provide a link here so I could take a look?Anonymous
August 22, 2011
Hi Aaron, Can you elaborate under what circumstances reboot after install may be required? Thanks.Anonymous
August 22, 2011
Hi John Doe - Reboot prompts occur when a setup needs to update resources (normally files, but also possibly things like registry keys/values, services, etc) that are being held in use by other processes on the computer.Anonymous
August 15, 2012
We are installing VC redist 2012 (version 10.0.40219.01) along with our application. We used the Installshield and the VC 2010 prerequisite, since it was older version 10.0.30319 we updated it with newer vcredist.exe. on x32 bit machines, without this redistributable our install prompts to install VC 2010 redist. But, on x64 bit machines, we are not getting the prompt from our installer to install VC redist 2010. My question is, How are companies deploying VC 2010 redist, - a) Use the prq which has set of conditions as it checks to see if vcredist needs to be installed. or b) just set a custom action to run the VCredist and run it in silent mode so user do not get the install. Please, any help is needed. It is urgent. thanks, MandeepAnonymous
August 16, 2012
Hi Mandeep - I don't know for sure how companies are doing this, but I can answer with my recommendation. I'd suggest that you always run the VC redistributable installer in silent mode and don't try to detect if it is already installed. I don't suggest running this as an MSI custom action though - you should use a chainer and have the chainer run the VC redistributable installer.Anonymous
May 07, 2013
Thanks Aaron for the helpful information. I am getting the UAC prompt while VCRedist 2010 both (x86 & x64) silently install. I tried following commands -
- <full path>vcredist_x86.exe /q /norestart
- <full path>vcredist_x64.exe /passive /norestart Please let me know the command which does not prompt for UAC. Thanks you. Shashi
Anonymous
May 08, 2013
Hi Shashi - These installers require elevated privileges in order to install correctly, and there isn't a way to suppress that requirement. If you want the installation process to not show a UAC prompt, it is the responsibility of the calling process to make sure that the installer is launched with elevated privileges in the first place.Anonymous
July 15, 2013
Hi, Aaron: I have the same issue as well. Even though the logged in user belongs to administrator group, it still prompt "Do you want to allow the following program to make changes to this computer?" while installing VC redistributable. I thought admin group is supposed to have all required privilege?? Also, there is a way to set windows/MSI property (IMSIDEPLOYMENTCOMPLIANT) to avoid UAC prompt in MSI projects. It will also make registry update fine. Is there any equavalent setting when launching redistributables in silent mode? Your help will be really appreciated. Thanks! NikkiAnonymous
July 16, 2013
Hi Nikki - Even if a user is in the Administrators group, they will need to respond to an elevation prompt before being allowed to install a per-machine .msi like the VC redistributable (unless UAC is disabled in the Windows control panel). There isn't a property that you can set to bypass that behavior. When launching redistributable setup packages in silent mode, it is up to the calling process to make sure that the child process is launched with elevated privileges. Usually, that means that the parent setup will need to prompt for elevation prior to running any child setup processes.Anonymous
March 07, 2014
I am getting some strage effects. I am starting VcRedist_x86.exe from an application that has prompted for UAC privileges, and must have obtained them to get to the point where VcRedist_x86.exe is started. I am using MsiQueryProductState and checking for (not)INSTALLSTATE_DEFAULT before continuing by calling VcRedist_x86.exe /passive /norestart. A number of people have reported getting a VcRedist repair window (and failed install). I do not get the same problem on my own PCs (Win7 and Win8.1). What on earth could possibly be going on here? Any ideas would be very much appreciated.Anonymous
March 07, 2014
Hi Peter - If the MSI API says that the product is not installed and the repair fails, then it is possible that the installed version is not actually the same as the one your application is trying to install. Does your application create any log files that you can have the customers send when they hit this behavior? Also, can you have your customers run the steps listed at blogs.msdn.com/.../434814.aspx to collect a list of installed programs on their computer so you can compare the installed VC redist versions to the one your application is trying to install?Anonymous
January 05, 2015
If you do the silent install, do you have to include Microsoft's redistributable license agreement in your own so that the users must approve that?Anonymous
January 05, 2015
Hi Dave - I'm sorry, but I don't know the legal requirements here. I'd suggest posting a question on the Visual Studio setup forum at social.msdn.microsoft.com/.../home to see if someone there knows the answer to this question.- Anonymous
July 29, 2016
I'm installing on a remote machine where the .exe is located on the target. I run /passive /norestart but the installation never happens. I tried adding the /log switch to generate some report but nothing gets generated. UAC disabled.- Anonymous
July 29, 2016
Hi yaro - How are you invoking the .exe on the target? Do you see any entries in the Application event log on the target that might explain why it is failing to launch the installer?- Anonymous
July 31, 2016
I go the Invoke-command way triggering Start-process with -ArgumentList- Anonymous
August 01, 2016
Turns up it all works fine just given the path and args so without start-process in the script block.
- Anonymous
- Anonymous
- Anonymous
- Anonymous
Anonymous
January 24, 2017
Will Microsoft automatically update Microsoft Visual C++ 2013 Redistributable (x64) and (x86)?Thank you- Anonymous
January 24, 2017
Hi Judith Strausberger - I think you will need to opt into Microsoft Update (as opposed to just Windows Update) in order to get updates for Microsoft products that aren't installed as a part of the Windows OS, and then if there are security updates released for the VC++ redistributable, they'll be offered to you. I'm not positive about that though. You might want to also post a question at https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vssetup to see if someone there can confirm that this is how things work for the VC++ redistributable.
- Anonymous