2023-10-03 08:18:00 +00:00
|
|
|
#Function to get the allow List apps
|
|
|
|
|
|
|
|
function Get-IncludedApps {
|
2024-03-15 09:39:51 +00:00
|
|
|
$AppIDs = @()
|
2023-10-03 08:18:00 +00:00
|
|
|
|
2024-09-01 13:54:36 +00:00
|
|
|
#whitelist in registry
|
2023-10-03 08:18:00 +00:00
|
|
|
if ($GPOList) {
|
|
|
|
|
2024-09-01 13:54:36 +00:00
|
|
|
Write-ToLog "-> Included apps from GPO is activated"
|
2023-10-03 08:18:00 +00:00
|
|
|
if (Test-Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList") {
|
|
|
|
$ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList").Property
|
|
|
|
foreach ($ValueName in $ValueNames) {
|
2024-03-08 12:01:29 +00:00
|
|
|
$AppIDs += (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList" -Name $ValueName).Trim()
|
2023-01-20 02:59:27 +00:00
|
|
|
}
|
2024-09-01 13:54:36 +00:00
|
|
|
Write-ToLog "-> Successsfully loaded included apps list."
|
2023-10-03 08:18:00 +00:00
|
|
|
}
|
2024-03-15 09:39:51 +00:00
|
|
|
|
2024-09-01 13:54:36 +00:00
|
|
|
}
|
|
|
|
#whitelist pulled from URI
|
2024-03-15 09:39:51 +00:00
|
|
|
elseif ($URIList) {
|
|
|
|
|
|
|
|
$RegPath = "$WAU_GPORoot";
|
|
|
|
$RegValueName = 'WAU_URIList';
|
2024-09-01 13:54:36 +00:00
|
|
|
|
2024-03-15 09:39:51 +00:00
|
|
|
if (Test-Path -Path $RegPath) {
|
|
|
|
$RegKey = Get-Item -Path $RegPath;
|
|
|
|
$WAUURI = $RegKey.GetValue($RegValueName);
|
2024-09-01 13:54:36 +00:00
|
|
|
Write-ToLog "-> Included apps from URI is activated"
|
2024-03-15 09:39:51 +00:00
|
|
|
if ($null -ne $WAUURI) {
|
|
|
|
$resp = Invoke-WebRequest -Uri $WAUURI -UseDefaultCredentials;
|
|
|
|
if ($resp.BaseResponse.StatusCode -eq [System.Net.HttpStatusCode]::OK) {
|
2024-09-01 13:54:36 +00:00
|
|
|
$resp.Content.Split([System.Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) |
|
2024-03-15 09:39:51 +00:00
|
|
|
ForEach-Object {
|
|
|
|
$AppIds += $_
|
|
|
|
}
|
2024-09-01 13:54:36 +00:00
|
|
|
Write-ToLog "-> Successsfully loaded included apps list."
|
2024-03-15 09:39:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-03 08:18:00 +00:00
|
|
|
|
|
|
|
}
|
2024-09-01 13:54:36 +00:00
|
|
|
#whitelist pulled from local file
|
2023-10-03 08:18:00 +00:00
|
|
|
elseif (Test-Path "$WorkingDir\included_apps.txt") {
|
|
|
|
|
2024-09-01 13:54:36 +00:00
|
|
|
$AppIDs = (Get-Content -Path "$WorkingDir\included_apps.txt").Trim()
|
|
|
|
Write-ToLog "-> Successsfully loaded local included apps list."
|
2023-10-03 08:18:00 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-03-15 09:39:51 +00:00
|
|
|
return $AppIDs | Where-Object { $_.length -gt 0 }
|
|
|
|
|
2022-09-25 14:54:58 +00:00
|
|
|
}
|