views:

16

answers:

0

Hi,

I am trying to use the new System.DirectoryServices.AccountManagement library to search the Active Directory and get the LastLogon times for users. I am using code that is very similar to the code found here: http://www.codeproject.com/KB/system/usingAccountManagement.aspx

I create a PrincipalContext object using a statement like:

PrincipalContext rootContext = new PrincipalContext(ContextType.Domain, "MyDomain", "DC=MyDomain,DC=com");

What I am wondering is how the lastLogon property of the UserPrincipal functions. In previous versions of Active Directory management one had to query each domain controller individually since the lastLogon property was not replicated across controllers.

With DirectoryServices.AccountManagement I don't seem to have a way to know which domain controller this property is coming from. Could someone maybe provide some additional information as to how this property functions?

Thanks