Configure Local GPE state from Powershell script

Hi All,

in Windows server 2008 r2 , for this manual process

open run >gpedit.msc > computer configuration > windows templates > windows update > specify intranet microsoft update service location > https://www.10.101.10.10.com and also state should be enabled.

May i know how to do this from powershell script.

Thanks in Advance

Those settings are entirely in the registry. You could probably open the ADM/ADMX file to see specifically where in the registry, and you could certainly use PowerShell’s registry drives (HKCU: and HKLM:) to modify the appropriate registry keys. I don’t personally know where those settings are in the registry - you would need to research that. http://technet.microsoft.com/en-us/library/dd939844(v=ws.10).aspx would be a good place to start - I believe it lists the keys you are looking for.

When you modify a setting that’s under “Administrative Templates” in the group policy editor, it gets stored in a file called registry.pol in the GPO’s folder. Assigning those settings directly in the registry has a similar effect as far as the system’s behavior is concerned, but you won’t see the changes in the Group Policy console.

There’s no built-in way to modify these registry.pol files from a script or command line in a local GPO, but I wrote some C# code to work with them a while back: http://gallery.technet.microsoft.com/scriptcenter/Read-or-modify-Registrypol-778fed6e . (Fair warning: it’s kind of ugly, but it works. I didn’t have much experience with C# or PowerShell when I wrote it.)