How to get user GUID from Active Directory using WinNT protocol?

I am trying to get user GUID from Active Directory. My code:

DirectoryEntry entry = new DirectoryEntry("WinNT://DOMAIN/UserName");
Console.WriteLine("The GUID of the ADS object:" + entry.Guid);
Console.WriteLine("The Native GUID of the ADS object:" + entry.NativeGuid);

      

The above code always returns d83f1060-1e71-11cf-b1f3-02608c9e7553 regardless of user and domain.

Is it possible to get the GUID GUID using the WinNT protocol?

+1


a source to share


2 answers


Look at Richard Mueller's Hilltop Lab , where he has many spreadsheets showing all the properties that various vendors provide. In particular, its list of properties provided by the WinNT vendor shows that there is no such thing as a custom "GUID" or OID or anything like that.

Please note that the WinNT provider is only used for backward compatibility and only really works on local accounts.



If you want to access DOMAIN accounts, you should definitely use an LDAP provider - it will give you access to all LDAP properties in the user account.

Mark

+4


a source


Perhaps you mean SID (security identifier). Like a GUID, it is unique, at least across the domain tree. I think the property is "objectSid". It is binary (byte []). I can't remember how big it is (28 bytes?), But I'm pretty sure it's not a GUID.



0


a source







All Articles