Solved

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

Posted on 2014-12-24
1
86 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
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.
Suggested Courses

636 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