Configure Local GPE state from Powershell script

Tagged: 

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 2 years, 3 months ago.

  • Author
    Posts
  • #18466
    Profile photo of Pandiyan M
    Pandiyan M
    Participant

    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

  • #18471
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

  • #18476
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    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.)

You must be logged in to reply to this topic.