Quantcast
Channel: Detect if Visual C++ Redistributable for Visual Studio 2012 is installed - Stack Overflow
Viewing all articles
Browse latest Browse all 22

Answer by Jim Wolff for Detect if Visual C++ Redistributable for Visual Studio 2012 is installed

$
0
0

The powershell script solution:

Based on the information in the answer from @kayleeFrye_onDeck

I have created a powershell script that checks and installs the versions the user specifies, i haven't done extensive testing with it, but for my own CI (Continuous Integration) scenario it work perfectly.

The full script and info on github

The approach i used was based on checking the regkeys based on information provided here. The following is the gist of what the script does:

function Test-RegistryValue {param ( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()]$Path, [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()]$Value)    try {    Get-ItemProperty -Path "$($Path+$Value)" -ErrorAction Stop | Out-Null        return $true    }    catch {        return $false    }}

The checking/downloading/silently installing based on $redistInfo which contains the compiled information from kayleeFrye_onDeck's.

$redistInstalled = Test-RegistryValue -Path $redistInfo.RegPath -Value $redistInfo.RegValueif($redistInstalled -eq $False) {    Invoke-WebRequest -Uri $redistInfo.DownloadUrl -OutFile $downloadTargetPath    Start-Process -FilePath $downloadTargetPath -ArgumentList "$($redistInfo.SilentInstallArgs)" -Wait -NoNewWindow | Wait-Process}

The full script and more information can be found on github

Anyone is welcome to contribute, if i have time i will do more extensive testing of the script and keep trying to add new packages as information is added here.


Viewing all articles
Browse latest Browse all 22


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>