2023-10-09 23:15:01 +00:00
|
|
|
#Function to get the WAU settings, including Domain/Local Policies (GPO)
|
|
|
|
|
|
|
|
Function Get-WAUConfig {
|
|
|
|
|
2023-10-12 12:00:10 +00:00
|
|
|
#Get WAU Configurations from install config
|
2024-09-13 20:06:18 +00:00
|
|
|
$WAUConfig_64_86 = Get-ItemProperty -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate*", "HKLM:\SOFTWARE\WOW6432Node\Romanitho\Winget-AutoUpdate*" -ErrorAction SilentlyContinue | Sort-Object { $_.ProductVersion } -Descending
|
|
|
|
$WAUConfig = $WAUConfig_64_86[0]
|
2023-10-12 12:00:10 +00:00
|
|
|
|
2023-10-11 22:53:21 +00:00
|
|
|
#Check if GPO Management is enabled
|
|
|
|
$ActivateGPOManagement = Get-ItemPropertyValue "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "WAU_ActivateGPOManagement" -ErrorAction SilentlyContinue
|
2023-10-09 23:15:01 +00:00
|
|
|
|
2023-10-12 12:00:10 +00:00
|
|
|
#If GPO Management is enabled, replace settings
|
2023-10-11 22:53:21 +00:00
|
|
|
if ($ActivateGPOManagement -eq 1) {
|
2023-10-09 23:15:01 +00:00
|
|
|
|
2023-10-11 22:53:21 +00:00
|
|
|
#Get all WAU Policies
|
|
|
|
$WAUPolicies = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -ErrorAction SilentlyContinue
|
2023-10-09 23:15:01 +00:00
|
|
|
|
2023-10-11 07:59:17 +00:00
|
|
|
#Replace loaded configurations by ones from Policies
|
2023-10-09 23:15:01 +00:00
|
|
|
$WAUPolicies.PSObject.Properties | ForEach-Object {
|
|
|
|
$WAUConfig.PSObject.Properties.add($_)
|
|
|
|
}
|
2023-10-12 12:00:10 +00:00
|
|
|
|
2023-10-09 23:15:01 +00:00
|
|
|
}
|
|
|
|
|
2023-10-11 22:53:21 +00:00
|
|
|
#Return config
|
2023-10-09 23:15:01 +00:00
|
|
|
return $WAUConfig
|
2024-09-02 14:10:21 +00:00
|
|
|
}
|