The string is the same with the exception of x86 and x64, so you can do a wildcard search. Both versions of the Runtime are installed, so the question is do you need to know if either is installed or a specific architecture? For instance, this would tell me if either:
$software = “Microsoft Visual C++ 2019 X* Additional Runtime - 14.22.27821”
$installed = Get-ItemProperty HKLM:\SOFTWARE\Classes\Installer\Products\* |
Where { $_.ProductName -like $software}
if ($installed) {
Write-Host (“‘Installed Software: rnrn{0}” -f (($installed | Select -ExpandProperty ProductName) -join "rn"))
} else {
Write-Host (“‘{0}’ NOT is installed.” -f $software)
}
Output:
Installed Software:
Microsoft Visual C++ 2019 X86 Additional Runtime - 14.22.27821
Microsoft Visual C++ 2019 X64 Additional Runtime - 14.22.27821
If you are installing a specific msi for each version, then you can do something like:
$installed = Get-ItemProperty HKLM:\SOFTWARE\Classes\Installer\Products\*
switch -wildcard ($installed.ProductName) {
“Microsoft Visual C++ 2019 X86 Additional Runtime - 14.22.27821” {"Do something for x86"}
“Microsoft Visual C++ 2019 X64 Additional Runtime - 14.22.27821” {"Do something for x64"}
default {"Don't care about $_.ProductName"}
}
Output:
Don't care about Office 16 Click-to-Run Extensibility Component.ProductName
Don't care about Office 16 Click-to-Run Localization Component.ProductName
Don't care about Office 16 Click-to-Run Extensibility Component 64-bit Registration.ProductName
Don't care about Office 16 Click-to-Run Licensing Component.ProductName
Don't care about Microsoft Online Services Sign-in Assistant.ProductName
Don't care about Microsoft ASP.NET Core 2.2.3 Shared Framework (x64).ProductName
Don't care about Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.4148.ProductName
Don't care about Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0.21005.ProductName
Don't care about Microsoft Visual C++ 2013 x86 Additional Runtime - 12.0.21005.ProductName
Don't care about Citrix Workspace Inside.ProductName
Don't care about Microsoft VC++ redistributables repacked..ProductName
Don't care about Teams Machine-Wide Installer.ProductName
Don't care about Zoom Outlook Plugin.ProductName
Don't care about VMware Horizon Media Redirection for Microsoft Teams.ProductName
Don't care about Citrix Workspace(Aero).ProductName
Don't care about VMware Horizon HTML5 Multimedia Redirection Client.ProductName
Don't care about Citrix Web Helper.ProductName
Don't care about Intel(R) Trusted Connect Service Client x86.ProductName
Don't care about Intel(R) Trusted Connect Service Client x64.ProductName
Don't care about UpdateAssistant.ProductName
Don't care about Intel(R) Management Engine Components.ProductName
Don't care about Self-service Plug-in.ProductName
Don't care about Intel(R) ME UninstallLegacy.ProductName
Don't care about Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005.ProductName
Don't care about Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161.ProductName
Don't care about Citrix Workspace(DV).ProductName
Don't care about Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161.ProductName
Don't care about Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005.ProductName
Don't care about Citrix Screen Casting for Windows.ProductName
Don't care about VMware Workstation.ProductName
Don't care about Microsoft .NET Core Host - 2.2.3 (x64).ProductName
Do something for x86
Don't care about PowerShell 7-x64.ProductName
Don't care about Intel(R) Chipset Device Software.ProductName
Don't care about Microsoft Visual C++ 2019 X86 Minimum Runtime - 14.22.27821.ProductName
Don't care about Kaspersky Secure Connection.ProductName
Don't care about Microsoft Exchange Web Services Managed API 2.2.ProductName
Don't care about VMware Horizon Media Engine 11.0.0.613 (64-bit).ProductName
Don't care about Google Update Helper.ProductName
Don't care about Citrix Authentication Manager.ProductName
Don't care about Microsoft VC++ redistributables repacked..ProductName
Don't care about Backup and Sync from Google.ProductName
Don't care about GlobalProtect.ProductName
Don't care about Microsoft Visual C++ 2019 X64 Minimum Runtime - 14.22.27821.ProductName
Don't care about Snagit 2020.ProductName
Don't care about VMware Horizon Client.ProductName
Don't care about Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4148.ProductName
Don't care about Citrix WorkSpace Browser.ProductName
Don't care about Intel(R) Management Engine Components.ProductName
Don't care about Online Plug-in.ProductName
Don't care about Update for Windows 10 for x64-based Systems (KB4023057).ProductName
Do something for x64
Don't care about Remote Desktop Connection Manager.ProductName
Don't care about Intel® PROSet/Wireless WiFi Software.ProductName
Don't care about Microsoft .NET Core Host FX Resolver - 2.2.3 (x64).ProductName
Don't care about Citrix Workspace (HDX Flash Redirection).ProductName
Don't care about Intel(R) Management Engine Driver.ProductName
Don't care about Microsoft .NET Core Runtime - 2.2.3 (x64).ProductName
Don't care about Citrix Workspace(USB).ProductName
Don't care about Microsoft .NET Core SDK 2.2.105 (x64).ProductName