From 608c0e95ca9e1787435df15338636dc47ffb9457 Mon Sep 17 00:00:00 2001 From: Nick Brown <109540830+nickjisc@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:39:37 +0000 Subject: [PATCH] Update Get-ExcludedApps.ps1 Fix Get-ExcludedApps where GPO is in use to properly generate the array --- .../Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 b/Sources/WAU/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 index 0212e5c..610b0d1 100644 --- a/Sources/WAU/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 @@ -10,16 +10,14 @@ function Get-ExcludedApps { $ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList").Property + $AppIDs = @() + foreach ($ValueName in $ValueNames) { - $AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false) - [PSCustomObject]@{ - Value = $ValueName - Data = $AppIDs.Trim() - } + $AppIDs += (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList" -Name $ValueName) } } - return $AppIDs + return $AppIDs | Where-Object { $_.length -gt 0 } } elseif (Test-Path "$WorkingDir\excluded_apps.txt") {