Skip to main content

Invoke-VcRedistModule

Description

This PowerShell script uses the VcRedist module to manage the installation, uninstallation, and listing of Visual C++ Redistributables.

Requirements

  • PowerShell v5+
  • Run as administrator

Usage

  • The script uses the Strapper module.
  • It utilizes the VCRedist module to manage Visual C++ Redistributables.
  • Functions are defined for setting working directories, installing supported redistributables, and uninstalling unsupported redistributables.
  • The script uses parameter sets to handle different operations such as listing, installing, uninstalling, and purging.
  • It includes error handling to manage exceptions during the process.
.\Invoke-VcRedistModule.ps1 -List

Lists all supported Visual C++ Redistributables.

.\Invoke-VcRedistModule.ps1 -List -Installed

Lists all installed Visual C++ Redistributables on the system.

.\Invoke-VcRedistModule.ps1 -Install -Release 2012 -Architecture x64

Installs the specified version (Release 2012) of Visual C++ Redistributable for x64 architecture.

.\Invoke-VcRedistModule.ps1 -Install -Release 2013,2019 -Architecture x64

Installs the specified versions (Release 2013 and 2019) of Visual C++ Redistributable for x64 architecture.

.\Invoke-VcRedistModule.ps1 -Install -Supported -Force

Installs all supported Visual C++ Redistributables even if they are already installed on the system.

.\Invoke-VcRedistModule.ps1 -Install -Supported

Installs all supported Visual C++ Redistributables on the system.

.\Invoke-VcRedistModule.ps1 -Uninstall -Release 2007

Uninstalls the specified version (Release 2007) of Visual C++ Redistributable.

.\Invoke-VcRedistModule.ps1 -Uninstall -Unsupported

Uninstalls the unsupported versions of Visual C++ Redistributable from the system.

.\Invoke-VcRedistModule.ps1 -Uninstall -All

Uninstalls all installed Visual C++ Redistributables.

.\Invoke-VcRedistModule.ps1 -Uninstall -Release 2007 -Architecture x86

Uninstalls the specified version (Release 2007) of Visual C++ Redistributable for x86 architecture from the system.

.\Invoke-VcRedistModule.ps1 -Uninstall -Release 2007,2003

Uninstalls the specified versions (Release 2003 and 2007) of Visual C++ Redistributable from the system.

.\Invoke-VcRedistModule.ps1 -Purge

Uninstalls unsupported redistributables and installs supported ones.

Parameters

ParameterParameterSetNameRequiredValidSetTypeDescription
ListListTrueSwitchLists the supported Visual C++ Redistributables.
InstalledListFalseSwitchLists the Visual C++ Redistributables currently installed on the system.
InstallInstallTrueSwitchInstalls a specified version of Visual C++ Redistributable.
SupportedInstallFalseSwitchInstalls the supported version of Visual C++ Redistributable.
UninstallUninstallTrueSwitchUninstalls a specified version of Visual C++ Redistributable.
UnsupportedUninstallFalseSwitchUninstalls any unsupported Visual C++ Redistributable.
AllUninstallFalseSwitchUninstalls all installed Visual C++ Redistributables.
ReleaseInstall,UninstallFalseint32[]Specifies the release version of Visual C++ Redistributable to install or uninstall.
ArchitectureInstall,Uninstall,ListFalsex64, x86StringSpecifies the architecture (x64 or x86) for Visual C++ Redistributable.
PurgePurgeTrueSwitchUninstalls unsupported Visual C++ Redistributables and installs supported ones.
ForceInstall,PurgeFalseSwitchPerforms an installation of a Visual C++ Redistributable even if it is already installed on the system.

Output

  • .\Invoke-VcRedistModule-log.txt
  • .\Invoke-VcRedistModule-Error.txt