Skip to main content

Install or Update the Visual C++ Redistributable on Windows (Windows script)

Description

Use the attached FileWave Fileset to install or update the Microsoft Visual C++ Redistributable on Windows devices when preparing an application dependency or troubleshooting a runtime problem. The Fileset downloads the latest supported Microsoft VC++ v14 Redistributable installers directly from Microsoft and runs them silently. It uses the install action, not Microsoft's separate repair action; do not treat a successful run as proof that an application problem has been repaired.

On 64-bit Windows, the script installs both the x64 and x86 redistributables because many 32-bit applications still depend on the x86 runtime. On 32-bit Windows, it installs only the x86 redistributable.

Ingredients

  • FileWave Central or FileWave Anywhere: Required to import, assign, and deploy the Fileset to Windows devices.

  • VC++ Redistributable Fileset: Download the Fileset using the link below.

Windows VC++ Redistributable
FileWave Download.png

Directions

Before assigning the Fileset, confirm that the application requires the v14 runtime and that the target Windows version is supported by Microsoft's current installer. Use the linked Microsoft download documentation for those requirements; the script downloads a changing latest version rather than a pinned installer. Visual C++ 2013 and earlier runtimes are separate packages that may still be needed by other applications. This Fileset is not a replacement for every Visual C++ runtime.

  1. Import the Fileset:

    • Download the Fileset from the link above.

    • Import the Fileset into FileWave Central or FileWave Anywhere.

  2. Review the script in the Fileset:

    • The Fileset contains the following PowerShell script. It checks whether Windows is 64-bit, builds the required installer list, downloads the redistributable installers from Microsoft, runs them silently, accepts success or success-with-reboot exit codes, and removes the temporary installer files.

      # Installs the latest supported Microsoft Visual C++ Redistributable.
      # On 64-bit Windows, this installs both x64 and x86 because many 32-bit apps still require the x86 runtime.
      # On 32-bit Windows, this installs only x86.
      
      $ErrorActionPreference = 'Stop'
      
      Write-Output "Detected PowerShell process architecture: $env:PROCESSOR_ARCHITECTURE"
      Write-Output "Detected OS is 64-bit: $([Environment]::Is64BitOperatingSystem)"
      
      # Microsoft aka.ms/vc14 links point to the current supported Visual C++ v14 runtime installers.
      # "v14" is Microsoft's runtime family name for Visual Studio 2015 and later supported releases.
      $Installers = @()
      
      if ([Environment]::Is64BitOperatingSystem) {
          $Installers += @{
              Name = 'Visual C++ Redistributable x64'
              Url  = 'https://aka.ms/vc14/vc_redist.x64.exe'
              Path = Join-Path $env:TEMP 'vc_redist.x64.exe'
          }
      
          $Installers += @{
              Name = 'Visual C++ Redistributable x86'
              Url  = 'https://aka.ms/vc14/vc_redist.x86.exe'
              Path = Join-Path $env:TEMP 'vc_redist.x86.exe'
          }
      }
      else {
          $Installers += @{
              Name = 'Visual C++ Redistributable x86'
              Url  = 'https://aka.ms/vc14/vc_redist.x86.exe'
              Path = Join-Path $env:TEMP 'vc_redist.x86.exe'
          }
      }
      
      foreach ($Installer in $Installers) {
          Write-Output "Downloading $($Installer.Name) from $($Installer.Url)"
      
          Invoke-WebRequest `
              -Uri $Installer.Url `
              -OutFile $Installer.Path `
              -UseBasicParsing
      
          Write-Output "Installing $($Installer.Name)"
      
          $Process = Start-Process `
              -FilePath $Installer.Path `
              -ArgumentList '/install', '/quiet', '/norestart' `
              -Wait `
              -PassThru
      
          Write-Output "$($Installer.Name) installer exit code: $($Process.ExitCode)"
      
          # 0 = success
          # 3010 = success, reboot required
          if ($Process.ExitCode -notin @(0, 3010)) {
              throw "$($Installer.Name) failed with exit code $($Process.ExitCode)"
          }
      
          Remove-Item -Path $Installer.Path -Force -ErrorAction SilentlyContinue
      }
      
      Write-Output 'Visual C++ Redistributable installation completed successfully.'
      
  3. Deploy and verify the Fileset:

    • Start with one managed Windows test device that has the FileWave Client installed. Create a Deployment for that device and this Fileset, review all pending changes, and run Update Model. Keep the device online and inspect the Fileset's script output and installer exit codes. Follow Deploy Windows Software with Filesets for the targeting, shared Model Update, and device-side verification steps.

On the test device, confirm the installed redistributable versions and launch the affected application. If an installer returns 3010, arrange the required restart before judging the application result. The script stops on an installer error, so on 64-bit Windows an x64 failure can prevent the x86 installer from running. Inspect the individual results rather than assuming both runtimes were installed. Expand the Deployment only after the application works as expected.

Notes

  • Microsoft permalink URLs: The script uses Microsoft-maintained aka.ms/vc14 download links for the current supported Visual C++ v14 runtime family. In Microsoft's naming, v14 refers to the Visual C++ runtime generation that started with Visual Studio 2015 and continues through later supported Visual Studio releases. It does not mean the Fileset installs only the original 2015/14.0 redistributable. The links redirect to Microsoft's latest supported installers for that runtime family.

  • Architecture behavior: The script checks the operating system bitness, not only the PowerShell process architecture. This prevents a 32-bit PowerShell process running on 64-bit Windows from causing the wrong installer set to be used.

  • Exit codes: The Microsoft installer exit code 0 is treated as success. Exit code 3010 is also treated as success, but it means Windows reports that a reboot is required.

  • Silent installation: The script runs each installer with /install /quiet /norestart. It does not force a reboot, so handle any needed restart through your normal maintenance or deployment process.

  • Network access: Devices must be able to reach Microsoft's aka.ms download URLs when the Fileset activates.