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

31 lines
986 B
PowerShell
Raw Permalink Normal View History

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