简体   繁体   English

如何使用WinNT协议从Active Directory获取用户GUID?

[英]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.

相关问题 从Active Directory获取GUID或本机GUID - Get GUID or Native GUID from Active Directory 从SQL Server获取Active Directory GUID - Get Active Directory GUID from SQL Server WinNT://提供程序何时查询Active Directory? 或者如果是域帐户,如何获取本地组成员的SID - When does WinNT:// provider query Active Directory? Or how to get SID of local group member if it is domain account 通过访问 Active Directory,我能否仅从用户名/电子邮件地址获取用户的 object GUID? - With access to Active Directory, can I get an object GUID for a user from an username/email address alone? 如何在Active Directory中使用GUID(objectGUID)参数查找用户 - How I can find a User with the GUID(objectGUID) Parameter in Active Directory 如何使用c#.net从他在winnt文件夹(本地用户和组)或活动目录(域下)中创建的pc中列出用户 - how to list out users from pc either he created in winnt folder(local users and groups) or active directory( under domain) using c#.net 通过guid列表获取Active Directory用户 - Get Active Directory users by a list of guid 使用员工 ID 检索 Active Directory GUID - Retrieve Active Directory GUID using employeeID 使用 DirectorySearcher 按 GUID 搜索 Active Directory 组 - Search Active Directory Group by GUID using DirectorySearcher 如何使用c#获取活动目录用户的不可变ID - How to get Immutable ID of active directory user by using c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM