Solved

AD property in UserPrincipal is not the same as in AD Users and Computer snap-in

Posted on 2014-12-24
1
82 Views
Last Modified: 2014-12-28
Hi, I'm using VS2013, C# and asp.net

In my code,my UserPrincipal object's AccountExpirationDate property shows 12/21/2014.  But when I check in AD Users and Computer snap-in, Account tab, it shows the account expires end of 12/19/2012.  That's 2 days difference.  Is this a known bug?  How to fix this?

Also, if the account is expired, today's date is 12/24/2012, however, UserPrincipal object's Enabled property still shows true and in AD Users and Computer snap-in the account doesn't have the account disabled checked either.  This data is correct but is mis-leading.  So when an account is expired, even though it's not disabled, user still can't log in using that account?

Thank you.
0
Comment
Question by:lapucca
1 Comment
 
LVL 17

Accepted Solution

by:
Tony Massa earned 500 total points
ID: 40517297
ADUC, and other tools generally decode this attribute to align with the date/time of the computer you're viewing the information from.

The accountExpires attribute is stored in a large integer that represents number of 100 millisecond intervals from Jan 1, 1601 (UTC)

http://msdn.microsoft.com/en-us/library/ms675098(v=vs.85).aspx

Here's some decode infomation for C#
http://stackoverflow.com/questions/6360284/convert-ldap-accountexpires-to-datetime-in-c-sharp
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In-place Upgrading Dirsync to Azure AD Connect
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question