[英]How to get user GUID from Active Directory using WinNT protocol?
I'm trying to get user GUID from Active Directory. 我正在尝试从Active Directory获取用户GUID。 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 code above always returns d83f1060-1e71-11cf-b1f3-02608c9e7553, regardless of the user and domain. 无论用户和域如何,上面的代码始终返回d83f1060-1e71-11cf-b1f3-02608c9e7553。
Is it possible to get user GUID using WinNT protocol? 是否可以使用WinNT协议获取用户GUID?
Check out Richard Mueller's Hilltop Lab where he has lots of spreadsheets showing all the properties the various providers expose. 查看Richard Mueller的Hilltop Lab ,他有很多电子表格,显示各个提供商所展示的所有属性。 In particular, his list of properties that the WinNT provider exposes shows that there's no such things as a user's "GUID" or OID or anything like that exposed.
特别是,他的WinNT提供程序公开的属性列表表明,没有用户的“GUID”或OID或类似暴露的东西。
Mind you - the WinNT provider is only used for backward compatibility, and really only works well on local machine accounts. 请注意 - WinNT提供程序仅用于向后兼容,并且仅适用于本地计算机帐户。
If you want to access DOMAIN accounts, you should by all means use the LDAP provider instead - it'll give you access to all the LDAP properties on a user account. 如果您想访问DOMAIN帐户,您应该使用LDAP提供程序 - 它将允许您访问用户帐户上的所有LDAP属性。
Marc 渣
Perhaps you mean SID (security identifier). 也许你的意思是SID(安全标识符)。 Like a GUID it is unique, at least across the domain tree.
与GUID一样,它是唯一的,至少跨域树。 I think the property is "objectSid".
我认为该属性是“objectSid”。 It's binary (byte[]).
它是二进制(byte [])。 I can't remember how big it is (28 bytes?) but I'm pretty sure it's not a GUID.
我记不清它有多大(28个字节?)但我很确定它不是GUID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.