GPO LIst ERROR handling

pull/263/head
KnifMelti 2023-01-21 17:14:25 +01:00
parent bce8f565b8
commit de8f32b50e
1 changed files with 20 additions and 5 deletions

View File

@ -127,12 +127,11 @@ if (Test-Network) {
#Get External ListPath if run as System #Get External ListPath if run as System
if ($WAUConfig.WAU_ListPath) { if ($WAUConfig.WAU_ListPath) {
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))"
if ($($WAUConfig.WAU_ListPath) -eq "GPO") { if ($($WAUConfig.WAU_ListPath) -eq "GPO") {
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))"
$Script:GPOList = $True $Script:GPOList = $True
} }
else { else {
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))"
$NewList = Test-ListPath $WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/") $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation.TrimEnd(" ", "\") $NewList = Test-ListPath $WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/") $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation.TrimEnd(" ", "\")
if ($ReachNoPath) { if ($ReachNoPath) {
Write-Log "Couldn't reach/find/compare/copy from $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))..." "Red" Write-Log "Couldn't reach/find/compare/copy from $($WAUConfig.WAU_ListPath.TrimEnd(" ", "\", "/"))..." "Red"
@ -197,10 +196,26 @@ if (Test-Network) {
$toSkip = Get-ExcludedApps $toSkip = Get-ExcludedApps
} }
#Fix the array if GPO List! #Fix and count the array if GPO List as ERROR handling!
if ($GPOList) { if ($GPOList) {
$toUpdate = $toUpdate.Data if ($UseWhiteList) {
$toSkip = $toSkip.Data $WhiteApps = $toUpdate.GetUpperBound(0)
$toUpdate = $toUpdate.Data
if ($null -eq $WhiteApps) {
Write-Log "Critical: White List doesn't exist in GPO, exiting..." "Red"
New-Item "$WorkingDir\logs\error.txt" -Value "White List doesn't exist in GPO!" -Force
Exit 1
}
}
else {
$BlackApps = $toSkip.GetUpperBound(0)
$toSkip = $toSkip.Data
if ($null -eq $BlackApps) {
Write-Log "Critical: Black List doesn't exist in GPO, exiting..." "Red"
New-Item "$WorkingDir\logs\error.txt" -Value "Black List doesn't exist in GPO!" -Force
Exit 1
}
}
} }
#Get outdated Winget packages #Get outdated Winget packages