Solved

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

Posted on 2014-12-24
1
84 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. 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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
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 update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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