Check only if $WAUPolicies exists
parent
50dcf3469e
commit
daa2e9ec4d
|
@ -28,6 +28,7 @@ $Script:WAUConfig = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Cur
|
|||
if ($IsSystem) {
|
||||
#Get WAU Policies and set the Configurations Registry Accordingly
|
||||
$WAUPolicies = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -ErrorAction SilentlyContinue
|
||||
if ($WAUPolicies) {
|
||||
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
||||
if ($null -ne $WAUPolicies.WAU_BypassListForUsers -and ($WAUPolicies.WAU_BypassListForUsers -ne $WAUConfig.WAU_BypassListForUsers)) {
|
||||
New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value $WAUPolicies.WAU_BypassListForUsers -PropertyType DWord -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
|
@ -45,6 +46,7 @@ if ($IsSystem) {
|
|||
New-ItemProperty $regPath -Name WAU_UseWhiteList -Value $WAUPolicies.WAU_UseWhiteList -PropertyType DWord -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Run post update actions if necessary
|
||||
if (!($WAUConfig.WAU_PostUpdateActions -eq 0)) {
|
||||
|
|
Loading…
Reference in New Issue