Merge pull request #720 from Romanitho/fix

Fix missing settings during MSI update settings migration
pull/722/head
Romain 2024-09-30 16:46:26 +02:00 committed by GitHub
commit 4bc17051a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -29,6 +29,11 @@ function Update-WAU {
New-Item -Path $destinationPath -ItemType Directory -Force New-Item -Path $destinationPath -ItemType Directory -Force
Write-ToLog "New registry key created." Write-ToLog "New registry key created."
} }
#Create missing default values
Set-ItemProperty -Path $destinationPath -Name "WAU_DoNotRunOnMetered" -Value 1 -Type Dword
Write-ToLog "WAU_DoNotRunOnMetered created. Value: 1"
Set-ItemProperty -Path $destinationPath -Name "WAU_UpdatesAtLogon" -Value 0 -Type Dword
Write-ToLog "WAU_UpdatesAtLogon created. Value 0"
#Retrieve the properties of the source key #Retrieve the properties of the source key
$properties = Get-ItemProperty -Path $sourcePath $properties = Get-ItemProperty -Path $sourcePath
foreach ($property in $properties.PSObject.Properties) { foreach ($property in $properties.PSObject.Properties) {
@ -36,7 +41,7 @@ function Update-WAU {
if ($property.Name -like "WAU_*" -and $property.Name -notlike "WAU_PostUpdateActions*") { if ($property.Name -like "WAU_*" -and $property.Name -notlike "WAU_PostUpdateActions*") {
#Copy the value to the destination key #Copy the value to the destination key
Set-ItemProperty -Path $destinationPath -Name $property.Name -Value $property.Value Set-ItemProperty -Path $destinationPath -Name $property.Name -Value $property.Value
Write-ToLog "$($property.Name) saved." Write-ToLog "$($property.Name) saved. Value: $($property.Value)"
} }
} }