Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify local group policy setting programatically

Tags:

group-policy

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.

like image 813
Aleks Avatar asked Jun 29 '10 01:06

Aleks


1 Answers

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.

like image 191
Martin Eden Avatar answered Jan 04 '23 17:01

Martin Eden