Small bits

pull/263/head
KnifMelti 2023-01-21 17:37:03 +01:00
parent de8f32b50e
commit 021170b72b
3 changed files with 23 additions and 18 deletions

View File

@ -200,21 +200,21 @@ if (Test-Network) {
if ($GPOList) { if ($GPOList) {
if ($UseWhiteList) { if ($UseWhiteList) {
$WhiteApps = $toUpdate.GetUpperBound(0) $WhiteApps = $toUpdate.GetUpperBound(0)
$toUpdate = $toUpdate.Data
if ($null -eq $WhiteApps) { if ($null -eq $WhiteApps) {
Write-Log "Critical: White List doesn't exist in GPO, exiting..." "Red" 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 New-Item "$WorkingDir\logs\error.txt" -Value "White List doesn't exist in GPO!" -Force
Exit 1 Exit 1
} }
$toUpdate = $toUpdate.Data
} }
else { else {
$BlackApps = $toSkip.GetUpperBound(0) $BlackApps = $toSkip.GetUpperBound(0)
$toSkip = $toSkip.Data
if ($null -eq $BlackApps) { if ($null -eq $BlackApps) {
Write-Log "Critical: Black List doesn't exist in GPO, exiting..." "Red" 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 New-Item "$WorkingDir\logs\error.txt" -Value "Black List doesn't exist in GPO!" -Force
Exit 1 Exit 1
} }
$toSkip = $toSkip.Data
} }
} }

View File

@ -7,15 +7,18 @@ function Get-ExcludedApps {
$Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList\' $Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList\'
$ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList").Property $ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList").Property
foreach ($ValueName in $ValueNames) { if ($ValueNames) {
$AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false) foreach ($ValueName in $ValueNames) {
[PSCustomObject]@{ $AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false)
Value = $ValueName [PSCustomObject]@{
Data = $AppIDs.Trim() Value = $ValueName
Data = $AppIDs.Trim()
}
} }
}
return $AppIDs return $AppIDs
}
} }
elseif (Test-Path "$WorkingDir\excluded_apps.txt") { elseif (Test-Path "$WorkingDir\excluded_apps.txt") {

View File

@ -6,17 +6,19 @@ function Get-IncludedApps {
$Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList\' $Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList\'
$ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList").Property $ValueNames = (Get-Item -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList").Property
foreach ($ValueName in $ValueNames) { if ($ValueNames) {
$AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false) foreach ($ValueName in $ValueNames) {
[PSCustomObject]@{ $AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false)
Value = $ValueName [PSCustomObject]@{
Data = $AppIDs.Trim() Value = $ValueName
Data = $AppIDs.Trim()
}
} }
return $AppIDs
} }
return $AppIDs
} }
elseif (Test-Path "$WorkingDir\included_apps.txt") { elseif (Test-Path "$WorkingDir\included_apps.txt") {