'VBScript object.GetInfo() returning attribute names different from .NET DirectorySearcher
I have been tasked with writing a C# replacement for a VBScript process that gets a list of all Active Directory user accounts with various object attributes.
The VBScript is taking an ADObject and invoking a method called .GetInfo(). I do not know anything about .GetInfo() (or VBScript either), but it is returning a lot of attributes that my DirectorySearcher is not.
Specifically, .GetInfo() returns attributes called "PasswordExpirationDate" and "PasswordLastChanged". But My DirectorySearcher results do not include those attribute names.
SearchResultCollection results;
DirectoryEntry de = new DirectoryEntry("LDAP://RootDSE");
DirectorySearcher ds = new DirectorySearcher("LDAP://" + de.Properties["defaultNamingContext"][0].ToString());
ds.PageSize = 1000;
ds.Filter = "(&(objectCategory=*)(objectClass=*))";
results = ds.FindAll();
This code does return attributes called "AccountExpires", and "PwdLastChanged". Also, .GetInfo() will return an attribute called "AccountDisabled" that does not exist in my DirectorySearcher results. In DirectorySearcher, the account disable status is in one of the UAC bits that I have decoded.
Is .GetInfo() "black boxing" and returning these same attributes just with different names? Or are they truly different attributes that DirectorySearcher is just not finding?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
