Upgrading or Repairing the Visual C++ Redistributable on Windows (Windows script)

Description

This article describes how to use the attached FileWave Fileset to install, update, or repair the Microsoft Visual C++ Redistributable on Windows devices. The Fileset downloads the latest supported Microsoft VC++ v14 Redistributable installers directly from Microsoft and runs them silently.

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

Windows VC++ Redistributable
FileWave Download.png

Directions

  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. Associate the Fileset:

    • Assign the Fileset to the Windows devices where the Visual C++ Redistributable needs to be installed, updated, or repaired.

Notes


Revision #9
Created 2024-09-11 12:44:46 UTC by Josh Levitsky
Updated 2026-05-20 20:56:58 UTC by Josh Levitsky