Microsoft Visual C++ 2019 Redistributable (x86): Difference between revisions

From LANCommander
No edit summary
No edit summary
Line 8: Line 8:


if ($Installed.Length -ge 0) {
if ($Installed.Length -ge 0) {
     exit 1;
     $Host.SetShouldExit(1)
} else {
} else {
     exit 0;
     $Host.SetShouldExit(0)
}
}
</syntaxhighlight>
</syntaxhighlight>

Revision as of 00:14, 30 November 2023

Install Detection

This script will look at the installed package list from Windows for anything matching Visual C++ 2019 Redistributable (x86).

$Installed = Get-Package "Microsoft Visual C++ 2015-20* Redistributable (x86)*"

if ($Installed.Length -ge 0) {
    $Host.SetShouldExit(1)
} else {
    $Host.SetShouldExit(0)
}

Install Script

This script installs the Visual C++ 2019 Redistributable (x86) redistributable silently.

Write-Host "Installing Visual C++ 2019 Redistributable (x86)..."
Start-Process -FilePath "VC_redist.x86.exe" -ArgumentList "/quiet /norestart" -Wait -Passthru
Write-Host "Done!"