Finally a GPO List Array that works with -contains
parent
a6e1a5030a
commit
e518369851
|
@ -197,6 +197,11 @@ if (Test-Network) {
|
||||||
$toSkip = Get-ExcludedApps
|
$toSkip = Get-ExcludedApps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Fix the array if GPO List!
|
||||||
|
if ($GPOList) {
|
||||||
|
$toSkip = $toSkip.Data
|
||||||
|
}
|
||||||
|
|
||||||
#Get outdated Winget packages
|
#Get outdated Winget packages
|
||||||
Write-Log "Checking application updates on Winget Repository..." "yellow"
|
Write-Log "Checking application updates on Winget Repository..." "yellow"
|
||||||
$outdated = Get-WingetOutdatedApps
|
$outdated = Get-WingetOutdatedApps
|
||||||
|
@ -231,7 +236,7 @@ if (Test-Network) {
|
||||||
if ($UseWhiteList) {
|
if ($UseWhiteList) {
|
||||||
#For each app, notify and update
|
#For each app, notify and update
|
||||||
foreach ($app in $outdated) {
|
foreach ($app in $outdated) {
|
||||||
if (($toUpdate -match $app.Id) -and $($app.Version) -ne "Unknown") {
|
if (($toUpdate -contains $app.Id) -and $($app.Version) -ne "Unknown") {
|
||||||
Update-App $app
|
Update-App $app
|
||||||
}
|
}
|
||||||
#if current app version is unknown
|
#if current app version is unknown
|
||||||
|
@ -248,7 +253,7 @@ if (Test-Network) {
|
||||||
else {
|
else {
|
||||||
#For each app, notify and update
|
#For each app, notify and update
|
||||||
foreach ($app in $outdated) {
|
foreach ($app in $outdated) {
|
||||||
if (-not ($toSkip -match $app.Id) -and $($app.Version) -ne "Unknown") {
|
if (-not ($toSkip -contains $app.Id) -and $($app.Version) -ne "Unknown") {
|
||||||
Update-App $app
|
Update-App $app
|
||||||
}
|
}
|
||||||
#if current app version is unknown
|
#if current app version is unknown
|
||||||
|
|
|
@ -4,7 +4,19 @@ function Get-ExcludedApps {
|
||||||
|
|
||||||
if ($GPOList) {
|
if ($GPOList) {
|
||||||
|
|
||||||
return Get-ItemProperty -Path "HKLM:\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
|
||||||
|
|
||||||
|
foreach ($ValueName in $ValueNames) {
|
||||||
|
$AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false)
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Value = $ValueName
|
||||||
|
Data = $AppIDs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $AppIDs
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif (Test-Path "$WorkingDir\excluded_apps.txt") {
|
elseif (Test-Path "$WorkingDir\excluded_apps.txt") {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,18 @@ function Get-IncludedApps {
|
||||||
|
|
||||||
if ($GPOList) {
|
if ($GPOList) {
|
||||||
|
|
||||||
return Get-ItemProperty -Path "HKLM:\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
|
||||||
|
|
||||||
|
foreach ($ValueName in $ValueNames) {
|
||||||
|
$AppIDs = [Microsoft.Win32.Registry]::GetValue($Key, $ValueName, $false)
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Value = $ValueName
|
||||||
|
Data = $AppIDs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $AppIDs
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif (Test-Path "$WorkingDir\included_apps.txt") {
|
elseif (Test-Path "$WorkingDir\included_apps.txt") {
|
||||||
|
|
Loading…
Reference in New Issue