pull/678/head
Romain 2024-09-01 15:54:36 +02:00
parent 513b459955
commit 8379e72f86
2 changed files with 15 additions and 13 deletions

View File

@ -43,14 +43,14 @@ function Get-ExcludedApps {
#blacklist pulled from local file
elseif (Test-Path "$WorkingDir\excluded_apps.txt") {
$AppIDs = (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 }
$AppIDs = (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim()
Write-ToLog "-> Successsfully loaded local excluded apps list."
}
#blacklist pulled from default file
elseif (Test-Path "$WorkingDir\config\default_excluded_apps.txt") {
$AppIDs = (Get-Content -Path "$WorkingDir\config\default_excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 }
$AppIDs = (Get-Content -Path "$WorkingDir\config\default_excluded_apps.txt").Trim()
Write-ToLog "-> Successsfully loaded default excluded apps list."
}

View File

@ -3,21 +3,20 @@
function Get-IncludedApps {
$AppIDs = @()
#region whitelist in registry
#whitelist in registry
if ($GPOList) {
Write-ToLog "-> Included apps from GPO is activated"
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) {
$AppIDs += (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList" -Name $ValueName).Trim()
}
Write-ToLog "-> Successsfully loaded included apps list."
}
}
#endregion whitelist in registry
#region whitelist pulled from URI
#whitelist pulled from URI
elseif ($URIList) {
$RegPath = "$WAU_GPORoot";
@ -26,6 +25,7 @@ function Get-IncludedApps {
if (Test-Path -Path $RegPath) {
$RegKey = Get-Item -Path $RegPath;
$WAUURI = $RegKey.GetValue($RegValueName);
Write-ToLog "-> Included apps from URI is activated"
if ($null -ne $WAUURI) {
$resp = Invoke-WebRequest -Uri $WAUURI -UseDefaultCredentials;
if ($resp.BaseResponse.StatusCode -eq [System.Net.HttpStatusCode]::OK) {
@ -33,15 +33,17 @@ function Get-IncludedApps {
ForEach-Object {
$AppIds += $_
}
Write-ToLog "-> Successsfully loaded included apps list."
}
}
}
}
#endregion whitelist pulled from URI
#whitelist pulled from local file
elseif (Test-Path "$WorkingDir\included_apps.txt") {
return (Get-Content -Path "$WorkingDir\included_apps.txt").Trim() | Where-Object { $_.length -gt 0 }
$AppIDs = (Get-Content -Path "$WorkingDir\included_apps.txt").Trim()
Write-ToLog "-> Successsfully loaded local included apps list."
}