Currently I am trying to set the local group policy "DoNotConnectToWindowsUpdateInternetLocations" programatically using powershell, so I thought simply adding the required registry keys would be enough. However, when I set the corresponding values in the registry, and reboot my system, the values in gpedit.msc are not changed.
So I thought to additionally run gpupdate /force to force the new values but this even makes the situation worse, i.e. directly after that call, all the registry values are resoted to their value before.
This computer is not part of a domain, and no policies are set from outside. So what additional magic happens in the background that is needed to set that policy successfully?
# Enable the policy
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name "DoNotConnectToWindowsUpdateInternetLocations" -Value 1
# Set the intranet update service location
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name "UpdateServiceUrl" -Value
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name "UpdateServiceUrlAlternate" -Value
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUServer" -Value
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUStatusServer" -Value
#after the following call, all settings are restored to their previous values
gpupdate /force