none
Enabling domain security policies RRS feed

  • Question

  • Hello,

    I'm trying to add a certain user to a security policy. I already found that I can use the LsaAddAccountRights method by using interop. But this method only seems to work if the policy is already enabled. And with 'enabled' I mean that in the 'Domain Security Policy' tool, in 'User Rights Assignment', if you right click a policy and call its properties, you will notice that the checkbox 'Define these policy settings' is unchecked. So, the LsaAddAccountRights only seems to work when this box is checked. Can I do this programmatically?

    Of course, if there is another way of doing so (a new .NET library that doesn't need interop for example) than that would be even better.

    P.S. I'm using the code I found here:

    http://bytes.com/topic/c-sharp/answers/266094-lsa-functions

    greets Stefan

    • Moved by Cookie Luo Thursday, February 10, 2011 9:35 AM (From:.NET Base Class Library)
    Tuesday, February 8, 2011 2:03 PM

Answers

  • Hi,

     

    Local Security Authority  is used to set privileges to the user. The following article speaks of how we can set the privileges :  http://support.microsoft.com/kb/132958

    However there is no .Net code available for the same .

    Also pertaining to the question whether is it possible to check or uncheck the 'Define these policy settings' programmatically so as to enable the LsaAddAccountRights, the answer is no. It’s not possible to do so.

     

    Regards,


    bill boyce
    Monday, February 14, 2011 10:42 PM
    Moderator

All replies

  • Hi Stefan,

    Move to CLR for better support.


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 10, 2011 9:34 AM
  • Hi,

     

    Local Security Authority  is used to set privileges to the user. The following article speaks of how we can set the privileges :  http://support.microsoft.com/kb/132958

    However there is no .Net code available for the same .

    Also pertaining to the question whether is it possible to check or uncheck the 'Define these policy settings' programmatically so as to enable the LsaAddAccountRights, the answer is no. It’s not possible to do so.

     

    Regards,


    bill boyce
    Monday, February 14, 2011 10:42 PM
    Moderator
  • Ok, it's a pity that it's not possible, but at least I have my answer now.

    Thank you for helping Bill.

    Regards, Stefan

    Wednesday, February 16, 2011 9:19 AM