Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Mailbag: How to perform a silent install of the Visual C++ 2010 redistributable packages

Mailbag: How to perform a silent install of the Visual C++ 2010 redistributable packages

  • Comments 45

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

  • 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.

  • 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?

  • Hi Michel - You can run the install command line and it should do a new install if the VC++ redistributable is not yet installed or a repair if it is already installed.  Please let me know if you run into any issues when trying to do this.

  • Yes, it seemss to work, but it looks to me that vcredist repair is broken from MS side itself. What I did was to install VCredist 2010 x86 (in UI mode), deleted file 'msvcr100' from c:\windoes\system32', then again run vcredist 2010 x86 (in UI mode) and choose repair. To my surprise, the file was not reverted back. Strange, but seems that vcredist repair is not working on expected line. It is not putting back the corrupt/missing files!

  • 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?

  • Hi Aaron,

    Can you elaborate under what circumstances reboot after install may be required?

    Thanks.

  • 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.

  • 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,

    Mandeep

  • 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.

  • Thanks Aaron for the helpful information.

    I am getting the UAC prompt while VCRedist 2010 both (x86 & x64) silently install.

    I tried following commands -

    1. <full path>\vcredist_x86.exe /q /norestart

    2. <full path>\vcredist_x64.exe /passive /norestart

    Please let me know the command which does not prompt for UAC.

    Thanks you.

    Shashi

  • 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.

  • 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!

    Nikki

  • 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.

  • 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.

  • 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?

Page 3 of 3 (45 items) 123
Leave a Comment
  • Please add 3 and 1 and type the answer here:
  • Post