Some of our computers have a random "local group policy" being set that forces them to check a nonexistent intranet server for Windows Updates instead of using WU over the internet as they should. This is happening only on certain random, unrelated computers. Simply fixing the setting locally does not solve the problem, as the value is reset when the computer restarts even though this is a local policy and not a domain one. All of the affected computers are running Windows 7 Enterprise, a mix of both 32- and 64-bit.
The solution has been to delete C:\Windows\System32\GroupPolicy\gpt.ini
and then manually set the value; this has worked. I'd like to write a quick script to do this automatically, but the appropriate registry keys are in the below registry location:
HKCU\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{EXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}Machine\Software\Policies\Microsoft\Windows\WindowsUpdate
The identifier in the middle is different on every computer and I have not been able to figure out what it is. It's not the user's or computer's AD GUID, and I don't know what else to even check.
How can I programmatically (PowerShell) determine what that identifier is so that it can be used in a script to edit the registry keys automatically?