wingetautoupdate/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1

32 lines
992 B
PowerShell
Raw Normal View History

2023-03-31 15:56:07 +00:00
#Function to get the Block List apps
2022-04-13 16:50:06 +00:00
function Get-ExcludedApps
{
if ($GPOList)
{
if (Test-Path -Path 'HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList' -ErrorAction SilentlyContinue)
{
$Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList\'
$ValueNames = (Get-Item -Path 'HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList').Property
foreach ($ValueName in $ValueNames)
{
$AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false)
[PSCustomObject]@{
Value = $ValueName
Data = $AppIDs.Trim()
}
}
}
return $AppIDs
}
elseif (Test-Path -Path ('{0}\excluded_apps.txt' -f $WorkingDir) -ErrorAction SilentlyContinue)
{
return (Get-Content -Path ('{0}\excluded_apps.txt' -f $WorkingDir)).Trim() | Where-Object -FilterScript {
$_.length -gt 0
}
}
2022-09-25 14:54:58 +00:00
}