Update Get-ExcludedApps.ps1

Fix Get-ExcludedApps where GPO is in use to properly generate the array
pull/580/head
Nick Brown 2024-03-06 15:39:37 +00:00 committed by GitHub
parent 59a4cc0771
commit 608c0e95ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 6 deletions

View File

@ -10,16 +10,14 @@ function Get-ExcludedApps {
$ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList").Property $ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList").Property
$AppIDs = @()
foreach ($ValueName in $ValueNames) { foreach ($ValueName in $ValueNames) {
$AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false) $AppIDs += (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList" -Name $ValueName)
[PSCustomObject]@{
Value = $ValueName
Data = $AppIDs.Trim()
}
} }
} }
return $AppIDs return $AppIDs | Where-Object { $_.length -gt 0 }
} }
elseif (Test-Path "$WorkingDir\excluded_apps.txt") { elseif (Test-Path "$WorkingDir\excluded_apps.txt") {