diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 878a838c2..e85b328fe 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -277,13 +277,17 @@ function Get-GHVersion { } function Get-VisualCPPComponents { - $vcpp = Get-CimInstance -ClassName Win32_Product -Filter "Name LIKE 'Microsoft Visual C++%'" - $vcpp | Sort-Object Name, Version | ForEach-Object { - $isMatch = $_.Name -match "^(?Microsoft Visual C\+\+ \d{4})\s+(?\w{3})\s+(?.+)\s+-" + $regKeys = @( + "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" + "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" + ) + $vcpp = Get-ItemProperty -Path $regKeys | Where-Object DisplayName -like "Microsoft Visual C++*" + $vcpp | Sort-Object DisplayName, DisplayVersion | ForEach-Object { + $isMatch = $_.DisplayName -match "^(?Microsoft Visual C\+\+ \d{4})\s+(?\w{3})\s+(?.+)\s+-" if ($isMatch) { $name = '{0} {1}' -f $matches["Name"], $matches["Ext"] $arch = $matches["Arch"].ToLower() - $version = $_.Version + $version = $_.DisplayVersion [PSCustomObject]@{ Name = $name Architecture = $arch