Active Directory : Liste de tous les attributs d'objet
Bonjour à tous,
J'ai un petit soucis avec Active Directory.
Je voudrais avoir la liste complète de tous les attributs pour un objet mais je n'en ai qu'une partie.
Par exemple, je souhaite obtenir la liste des attributs des objets Computer, je fais ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
try
{
DirectoryEntry Ldap = new DirectoryEntry("LDAP://" + ADdomaine, ConfigurationManager.AppSettings.Get("ADuser"), ConfigurationManager.AppSettings.Get("ADpwd"));
DirectorySearcher searcher = new DirectorySearcher(Ldap);
searcher.Filter = "(objectClass=" + ADtype + ")";
foreach (SearchResult result in searcher.FindAll())
{
DirectoryEntry DirEntry = result.GetDirectoryEntry();
foreach (string property in DirEntry.Properties.PropertyNames)
{
panelMessage.InnerHtml += DirEntry.Properties[property].PropertyName.ToString() + "=>" + DirEntry.Properties[property].Value.ToString() + "<br>";
}
}
}
catch (Exception Ex)
{
panelMessage.InnerHtml += "Erreur LDAP : " + Ex.ToString();
} |
et j'obtiens cela :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| objectClass=>System.Object[]
cn=>DC1
distinguishedName=>CN=DC1,OU=Domain Controllers,DC=stage,DC=local
instanceType=>4
whenCreated=>15/09/2008 12:45:10
whenChanged=>15/09/2008 12:48:45
uSNCreated=>System.__ComObject
uSNChanged=>System.__ComObject
name=>DC1
objectGUID=>System.Byte[]
userAccountControl=>532480
badPwdCount=>0
codePage=>0
countryCode=>0
badPasswordTime=>System.__ComObject
lastLogoff=>System.__ComObject
lastLogon=>System.__ComObject
localPolicyFlags=>0
pwdLastSet=>System.__ComObject
primaryGroupID=>516
objectSid=>System.Byte[]
accountExpires=>System.__ComObject
logonCount=>20
sAMAccountName=>DC1$
sAMAccountType=>805306369
operatingSystem=>Windows Server 2003
operatingSystemVersion=>5.2 (3790)
operatingSystemServicePack=>Service Pack 2
serverReferenceBL=>CN=DC1,CN=Servers,CN=Premier-Site-par-defaut,CN=Sites,CN=Configuration,DC=stage,DC=local
dNSHostName=>dc1.stage.local
rIDSetReferences=>CN=RID Set,CN=DC1,OU=Domain Controllers,DC=stage,DC=local
servicePrincipalName=>System.Object[]
objectCategory=>CN=Computer,CN=Schema,CN=Configuration,DC=stage,DC=local
isCriticalSystemObject=>True
frsComputerReferenceBL=>CN=DC1,CN=Domain System Volume (SYSVOL share),CN=File Replication Service,CN=System,DC=stage,DC=local
nTSecurityDescriptor=>System.__ComObject |
alors que l'objet possède 3 ou 4 fois plus d'attributs.
Comment puis-je résoudre ça ?
Merci d'avance.
Edit :
Je viens de comprendre une partie. Ce sont les champs renseignés que je ressors et je souhaiterais avoir tous les attributs, même ceux qui sont vides.