Avoid $toUpdate/$toSkip.GetUpperBound(0)
parent
a0be726d22
commit
d3df7f7f24
|
@ -239,8 +239,7 @@ if (Test-Network) {
|
||||||
#Fix and count the array if GPO List as ERROR handling!
|
#Fix and count the array if GPO List as ERROR handling!
|
||||||
if ($GPOList) {
|
if ($GPOList) {
|
||||||
if ($UseWhiteList) {
|
if ($UseWhiteList) {
|
||||||
$WhiteList = $toUpdate.GetUpperBound(0)
|
if (-not $toUpdate) {
|
||||||
if ($null -eq $WhiteList) {
|
|
||||||
Write-ToLog "Critical: Whitelist doesn't exist in GPO, exiting..." "Red"
|
Write-ToLog "Critical: Whitelist doesn't exist in GPO, exiting..." "Red"
|
||||||
New-Item "$WorkingDir\logs\error.txt" -Value "Whitelist doesn't exist in GPO" -Force
|
New-Item "$WorkingDir\logs\error.txt" -Value "Whitelist doesn't exist in GPO" -Force
|
||||||
Exit 1
|
Exit 1
|
||||||
|
@ -248,8 +247,7 @@ if (Test-Network) {
|
||||||
foreach ($app in $toUpdate) { Write-ToLog "Include app ${app}" }
|
foreach ($app in $toUpdate) { Write-ToLog "Include app ${app}" }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$BlackList = $toSkip.GetUpperBound(0)
|
if (-not $toSkip) {
|
||||||
if ($null -eq $BlackList) {
|
|
||||||
Write-ToLog "Critical: Blacklist doesn't exist in GPO, exiting..." "Red"
|
Write-ToLog "Critical: Blacklist doesn't exist in GPO, exiting..." "Red"
|
||||||
New-Item "$WorkingDir\logs\error.txt" -Value "Blacklist doesn't exist in GPO" -Force
|
New-Item "$WorkingDir\logs\error.txt" -Value "Blacklist doesn't exist in GPO" -Force
|
||||||
Exit 1
|
Exit 1
|
||||||
|
|
Loading…
Reference in New Issue