locked
Updating AD accountExpires field not taking effect RRS feed

  • Question

  • In C# I am able to set the initial value of accountExpires when I create an Account, but when I use the same code to try and update that value later, it does not take effect - the accountExpires field retains its original value.

    The code I am using is (account is a DirectoryEntry):

    account.Properties["accountExpires"].Value = Convert.ToString(expire.ToFileTime());

    Where expire is a DateTime.

    I have also tried

    account.InvokeSet("AccountExpirationDate", new object[] { expire });

    because I found an example of somebody doing that. 

    Is there any permission or whatever that would allow the executing user to initially create an accountExpires value, but not to update it later?

    Thanks in advance for any clues!

    Wednesday, August 12, 2020 2:14 PM

All replies

  • Hi David,

    Thank you for posting here.

    According to the documentation, it seems that there is indeed such a permission.

    Account-Expires attribute

    Maybe you can get more help here:Active Directory and LDAP.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 13, 2020 3:23 AM