# Upgrading or Repairing the Visual C++ Redistributable on Windows (Windows script)
## Description
This article describes how to use the attached FileWave Fileset to install or update the Microsoft Visual C++ Redistributable (VC++). The provided Fileset ensures that the appropriate version of VC++ is installed based on the processor architecture (AMD64, ARM64, or x86) of the device. The script included in the Fileset automatically downloads the correct VC++ installer from Microsoft, installs it, and then performs cleanup.
## Ingredients
- **FileWave Admin**: Required to import and deploy the Fileset to Windows devices.
- **VC++ Fileset**: Download the Fileset using the link below.
**Windows VC++ v17** |
[](https://kb.filewave.com/attachments/394) |
## Directions
1. **Import the Fileset:**
- Download the Fileset from the link above.
- Import the Fileset into the FileWave Admin console.
2. **Review the Script in the Fileset:**
- The Fileset contains the following PowerShell script that determines the system architecture, downloads the appropriate version of VC++, installs it, and cleans up the temporary files.
```powershell
echo $env:PROCESSOR_ARCHITECTURE
# Determine processor architecture
$Architecture = $env:PROCESSOR_ARCHITECTURE
if ($Architecture -eq 'AMD64') {
$InstallerUrl = 'https://aka.ms/vs/17/release/vc_redist.x64.exe'
} elseif ($Architecture -eq 'ARM64') {
$InstallerUrl = 'https://aka.ms/vs/17/release/vc_redist.arm64.exe'
} else {
$InstallerUrl = 'https://aka.ms/vs/17/release/vc_redist.x86.exe'
}
echo $InstallerUrl
# Download installer
$InstallerPath = "$env:TEMP\vc_redist.exe"
Invoke-WebRequest -Uri $InstallerUrl -OutFile $InstallerPath
# Install Visual C++ redistributable
Start-Process -FilePath $InstallerPath -ArgumentList '/install', '/passive', '/norestart' -Wait
# Clean up
Remove-Item -Path $InstallerPath
```
3. **Associate the Fileset:**
- Assign the Fileset to the relevant Windows devices where VC++ needs to be installed or updated.
## Notes
- **Customizations:** If a newer version of VC++ is required, you can update the URLs in the script to point to the latest Microsoft Visual C++ Redistributable version.
- **Architecture Detection:** The script handles common architectures like AMD64, ARM64, and x86, which are automatically detected and used to download the appropriate version of VC++.
- **Silent Installation:** The script installs VC++ in passive mode without user interaction and suppresses a reboot. If you need a different installation behavior, modify the argument list in the Start-Process command.
## Related Content
- [Microsoft Visual C++ Redistributable Documentation](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170)