none
C# API/code to find out if a local user's password was never set to expire RRS feed

  • Question

  • I was trying to find out a Microsoft API, which would help me in getting the local user's setting which says password never expires.  I was searching a property in                     

    using (var userEntry = new System.DirectoryServices.DirectoryEntry("WinNT://" + domain + '/' + user + ",user"))
    {DateTime expiryDate = (DateTime)userEntry.InvokeGet("PasswordExpirationDate");}

    Needed a similar property to "PasswordExpirationDate" which would tell me whether the user's password setting is set ot expire or not. Or a way to get that in  C# code through some other API. 

    Any leads/help in this regard is much appreciated.

    Thanks in advance.

                     

    Friday, July 27, 2018 12:23 PM