How to modify local group policy setting programatically

14,455

I wrote a .NET library to assist with this problem. You can read about it here. It is open and source and you can get code and binaries here. Once you know the registry values that are relevant you can make the necessary changes to them using this library and it will save them into the registry.pol file.

Share:
14,455
Admin
Author by

Admin

Updated on June 09, 2022

Comments

  • Admin
    Admin about 2 years

    I am looking for a way to programatically change the value of a group policy setting without having to reboot a machine or install any additional components on it

    Looking for a solution for Windows 2003, 2008, machines are part of the domain

    The value is under Administrative Templates\Network\QoS Packet Scheduler, Limit outstanding packets

    Tried the following:

    • Change registry directly - this doesn't work, as the value is actually stored in registry.pol file and is propagated from there to the registry

    • Used WMI - WMI objects that are representing the registry are read only, value is not modified

    One option that seems to work is to modify the registry.pol file under C:\Windows\System32\GroupPolicy\Machine, however this seems problematic, I will have to parse this file manually.