Group Policy in C#


All replies

  • Check out this post C# Group Policy to see if this end around works for you.
    William Wegerson (www.OmegaCoder.Com)
    Wednesday, May 06, 2009 5:34 AM
  • Well, my problem is not related to active directory--I want it to run on any pc, locally.

    And the setting I'm changing does not show up in the registry as the post suggests (although the task manager one they show does for some reason).

    I think that COM library is probably the way to go, anyone know where I can get it?
    Wednesday, May 06, 2009 1:45 PM
  • This site, not a microsoft site has a version of it Download File: MICROSOFT.GROUPPOLICY.GPMGMTLIB.DLL .

    Note I surmise this dll was made for XP...if you are running Vista, all bets are off. Even if you are running XP, I recommend you work on an alternate system or virtual environment to verify there are no hidden gotchas. GL HTH.
    William Wegerson (www.OmegaCoder.Com)
    Wednesday, May 06, 2009 3:19 PM
  • I managed to find this dll on a Windows Server 2008 box we had, but sadly I read this from that first link I saw:

    The IGPMGPO interface supports methods that enable you to manage Group Policy Objects (GPOs) in the directory service.

    Note that you cannot use this interface to manage local GPOs (LGPOs)

    So I guess that will not work...

    Wednesday, May 06, 2009 9:12 PM
  • So is this something that may not necessarily be possible because of security reasons?

    I could see where the ability to disallow a user access to things programmatically could be an issue.  

    Sadly I just need to change one setting, that I have not been able to change through the registry.  I'll see if regmon/procmon give any clues...
    • Marked as answer by Figo Fei Monday, May 11, 2009 3:40 AM
    • Unmarked as answer by Jonathan.Peppers Monday, May 11, 2009 4:58 PM
    Friday, May 08, 2009 5:29 PM
  • As most of my posts, there seems to be no answer...

    So I'll say my question unanswerable.
    Monday, May 18, 2009 6:02 PM
  • Jon,

    Have you got the answer for this ? I am also looking similar to this.
    Tuesday, August 11, 2009 4:13 PM
  • No, I don't think there is a good way to do it that is universal.

    If your computers are setup through a domain, I think there are ways to programmatically apply group policy on the server and have that applied to specific users.

    We needed this to work on any computer though...
    Wednesday, August 19, 2009 4:51 PM
  • To access Local Security Policy settings, you could use the LSA API .  It would likely be easier to use SecEdit and batch file though.
    Wednesday, August 19, 2009 6:15 PM
  • Hi

    I want to edit the Group policy in c#

    Can anyone help me to fix this issue kindly. I have just created Group policies using c#. Now want to edit these policies


    Any little help will be appreciated greatly


    Thanks in Advance


    Sohaib Qazi

    Monday, April 05, 2010 1:30 PM
  • Sohaib,

    Would you tell me how did you create Group Policies? I also need help for doing such operations.

    Thanks in advance

    Rafsanul Hasan

    Wednesday, December 05, 2012 12:39 PM
  • Please see, where I discuss how to do this.
    • Proposed as answer by Story Weaver Thursday, December 05, 2013 11:53 AM
    Thursday, December 05, 2013 11:53 AM