From c5d5ee1b5ea83dfabc207ce45b9ffdf3934f7ece Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Wed, 26 Apr 2023 22:43:11 +0200 Subject: [PATCH] GPO management added --- Policies/WAU.admx | 10 ++++++++++ Policies/en-US/WAU.adml | 10 +++++++--- Winget-AutoUpdate/functions/Get-Policies.ps1 | 9 +++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Policies/WAU.admx b/Policies/WAU.admx index 3106d8b..db17dd5 100644 --- a/Policies/WAU.admx +++ b/Policies/WAU.admx @@ -349,6 +349,16 @@ + + + + + + + + + + diff --git a/Policies/en-US/WAU.adml b/Policies/en-US/WAU.adml index e9d1f05..85d1a26 100644 --- a/Policies/en-US/WAU.adml +++ b/Policies/en-US/WAU.adml @@ -45,8 +45,8 @@ If "Application GPO Blacklist/Whitelist" is set in this GPO the Path can be: GPO If this policy is disabled or not configured, the default ListPath is used (WAU InstallLocation). Get Mods from external Path (URL/UNC/Local/AzureBlob) - If this policy is enabled, you can set a (URL/UNC/Local/AzureBlob) Path to external mods other than the default. - + If this policy is enabled, you can set a (URL/UNC/Local/AzureBlob) Path to external mods other than the default. + If this policy is disabled or not configured, the default ModsPath is used (WAU InstallLocation). Note: When set to 'AzureBlob', ensure you also configure 'Set Azure Blob URL with SAS token'. @@ -140,6 +140,10 @@ If this policy is disabled or not configured, the default number is used. + Specify if user approval is needed before updating apps + This policy setting specifies whether to require user approval before updatings available application updates . + +If this policy is disabled or not configured, the default is No. @@ -157,7 +161,7 @@ If this policy is disabled or not configured, the default size is used. - + diff --git a/Winget-AutoUpdate/functions/Get-Policies.ps1 b/Winget-AutoUpdate/functions/Get-Policies.ps1 index 0200341..8653019 100644 --- a/Winget-AutoUpdate/functions/Get-Policies.ps1 +++ b/Winget-AutoUpdate/functions/Get-Policies.ps1 @@ -356,6 +356,15 @@ Function Get-Policies { $ChangedSettings++ } + if ($null -ne $($WAUPolicies.WAU_UserApproval) -and ($($WAUPolicies.WAU_UserApproval) -ne $($WAUConfig.WAU_UserApproval))) { + New-ItemProperty $regPath -Name WAU_UserApproval -Value $($WAUPolicies.WAU_UserApproval) -PropertyType DWord -Force | Out-Null + $ChangedSettings++ + } + elseif ($null -eq $($WAUPolicies.WAU_UserApproval) -and ($($WAUConfig.WAU_UserApproval) -or $($WAUConfig.WAU_UserApproval) -eq 0)) { + Remove-ItemProperty $regPath -Name WAU_UserApproval -Force -ErrorAction SilentlyContinue | Out-Null + $ChangedSettings++ + } + #Get WAU Configurations after Policies change $Script:WAUConfig = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" }