Upgrading or Repairing the Visual C++ Redistributable on Windows (Windows script)
Description
This article describes how to use the attached FileWave Fileset to installinstall, update, or updaterepair the Microsoft Visual C++ Redistributable (VC++).on Windows devices. The provided Fileset ensures thatdownloads the appropriatelatest versionsupported ofMicrosoft VC++ isv14 installedRedistributable basedinstallers 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 processorx86 architectureruntime. (AMD64,On ARM64,32-bit orWindows, x86)it ofinstalls only the device.x86 The script included in the Fileset automatically downloads the correct VC++ installer from Microsoft, installs it, and then performs cleanup.redistributable.
Ingredients
-
FileWave Admin: Required to import and deploy the Fileset to Windows devices.
-
VC++ Redistributable Fileset: Download the Fileset using the link below.
| Windows VC++ |
![]() |
Directions
-
Import the Fileset:
-
Download the Fileset from the link above.
-
Import the Fileset into the FileWave Admin console.
-
-
Review the
Scriptscript in the Fileset:-
The Fileset contains the following PowerShell
scriptscript.thatItdetermineschecks whether Windows is 64-bit, builds thesystemrequiredarchitecture,installer list, downloads theappropriateredistributableversioninstallersoffromVC++,Microsoft,installsrunsit,them silently, accepts success or success-with-reboot exit codes, andcleans upremoves the temporary installer files.echo# 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_ARCHITECTUREPROCESSOR_ARCHITECTURE" Write-Output "Detected OS is 64-bit: $([Environment]::Is64BitOperatingSystem)" #DetermineMicrosoftprocessorlatest-supportedarchitectureVC++ v14 Redistributable permalink URLs $ArchitectureInstallers =$env:PROCESSOR_ARCHITECTURE@() if ($Architecture -eq 'AMD64')[Environment]::Is64BitOperatingSystem) { $InstallerUrlInstallers += @{ Name = 'Visual C++ Redistributable x64' Url = 'https://aka.ms/vs/17/release/vc14/vc_redist.x64.exe' Path = Join-Path $env:TEMP 'vc_redist.x64.exe' }elseif$Installers($Architecture+=-eq@{ Name = 'ARM64')Visual{C++$InstallerUrlRedistributable x86' Url = 'https://aka.ms/vs/17/release/vc14/vc_redist.arm64.x86.exe' Path = Join-Path $env:TEMP 'vc_redist.x86.exe' } } else { $InstallerUrlInstallers += @{ Name = 'Visual C++ Redistributable x86' Url = 'https://aka.ms/vs/17/release/vc14/vc_redist.x86.exe' Path = Join-Path $env:TEMP 'vc_redist.x86.exe' }echo} foreach ($Installer in $InstallerUrlInstallers)#{DownloadWrite-Outputinstaller"Downloading $InstallerPath($Installer.Name)=from $($Installer.Url)"$env:TEMP\vc_redist.exe"Invoke-WebRequest ` -Uri $InstallerUrlInstaller.Url ` -OutFile $InstallerPathInstaller.Path#`Install-UseBasicParsingVisualWrite-OutputC++"Installingredistributable$($Installer.Name)" $Process = Start-Process ` -FilePath $InstallerPathInstaller.Path ` -ArgumentList '/install', '/passive'quiet', '/norestart' ` -Wait ` -PassThru Write-Output "$($Installer.Name) installer exit code: $($Process.ExitCode)" #Clean0up= success # 3010 = success, reboot required if ($Process.ExitCode -notin @(0, 3010)) { throw "$($Installer.Name) failed with exit code $($Process.ExitCode)" } Remove-Item -Path $InstallerPathInstaller.Path -Force -ErrorAction SilentlyContinue } Write-Output 'Visual C++ Redistributable installation completed successfully.'
-
-
Associate the Fileset:
-
Assign the Fileset to the
relevantWindows devices whereVC+the Visual C++ Redistributable needs to beinstalledinstalled, updated, orupdated.repaired.
-
Notes
-
Customizations:Microsoft permalink URLs:IfTheascriptnewerusesversionMicrosoft'soflatest-supported VC++isv14required,RedistributableyoupermalinkcanURLs.updateInthenormalURLsuse,inthesethelinksscriptcontinue to point to the current supported installers, so the Fileset does not need to be edited just to receive the latestMicrosoftsupportedVisual C++ Redistributable version.redistributable. -
Architecture
Detection:behavior: The scripthandlescheckscommonthearchitecturesoperatinglikesystemAMD64,bitness,ARM64,notandonlyx86,thewhichPowerShellareprocessautomaticallyarchitecture.detectedThisandpreventsuseda 32-bit PowerShell process running on 64-bit Windows from causing the wrong installer set todownloadbetheused.appropriate
Exit VC++.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:installation: The script installsruns VC++each ininstaller passivewith mode/install . without/quiet user/norestartinteractionIt anddoes suppressesnot force a reboot.reboot, Ifso youhandle needany aneeded differentrestart installationthrough behavior,your modifynormal maintenance or deployment process.
Network access: Devices must be able to reach Microsoft's aka.ms download URLs when the argumentFileset list in the Start-Process command.activates.
