diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index 5ab9ad0d..0fd6bc8b 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -69,8 +69,12 @@ function Get-VisualStudioPath { return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).InstallationPath } -function Get-VisualStudioComponents { - $vsPackages = (Get-VSSetupInstance | Select-VSSetupInstance -Product *).Packages.Id - $vsPackages | Select-Object @{n = 'Package'; e = {$_}} | - Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" } +function Get-VisualStudioPackages { + return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).Packages } + +function Get-VisualStudioComponents { + Get-VisualStudioPackages | Where-Object type -in 'Component', 'Workload' | + Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version | + Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" } +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index 43f81801..0004c168 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -1,10 +1,3 @@ -function Get-VisualStudioPackages -{ - $packagePath = "$env:ProgramData\Microsoft\VisualStudio\Packages\_Instances\*\state.packages.json" - $instanceFolders = Get-ChildItem -Path $packagePath - (Get-Content -Path $instanceFolders | ConvertFrom-Json).packages -} - function Get-VisualStudioVersion { $vsVersion = vswhere -format json | ConvertFrom-Json [PSCustomObject]@{ @@ -14,12 +7,6 @@ function Get-VisualStudioVersion { } } -function Get-VisualStudioComponents { - $vsPackages = Get-VisualStudioPackages | Where-Object type -in 'Component', 'Workload' - $vsPackages | Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version | - Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" } -} - function Get-WixVersion { $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" $installedApplications = Get-ItemProperty -Path $regKey @@ -36,7 +23,7 @@ function Get-VisualStudioExtensions { # Wix $vs = (Get-VisualStudioVersion).Name.Split()[-1] $wixPackageVersion = Get-WixVersion - $wixExtensionVersion = (Get-VisualStudioPackages | Where-Object {$_.id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version + $wixExtensionVersion = (Get-VisualStudioPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version # WDK $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit'