Account expires value in LDAP.

  • Thread starter Thread starter Arne Garvan
  • Start date Start date
A

Arne Garvan

Guest
var rootEntry = new DirectoryEntry("LDAP://xxx.com");
var directorySearcher = new DirectorySearcher(rootEntry, String.Format("(sAMAccountName={0})", acctName));
var searchResult = directorySearcher.FindOne();
if (searchResult != null)
{
using (var userEntry = searchResult.GetDirectoryEntry())
{
PropertyValueCollection acc = (PropertyValueCollection)userEntry.Properties["accountexpires"];
long accountExp = 0;// (long)acc[0].Value;
DateTime dt = new DateTime(1601, 01, 02).AddTicks(accountExp);
}
}

How do I get the account expire into a DateTime value?

Continue reading...
 
Back
Top