查询特定用户的Active Directory [英] Querying Active Directory for a specific user

查看:87
本文介绍了查询特定用户的Active Directory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了ADezii非常好地解决的以下主题: ...从AD中获取信息...... 。但是,这只是为当前用户提供的。我希望能够指定用户,以便我可以获取他们的电子邮件地址。我在网上做过的研究( ADSI Active Directory ),您必须使用LDAP而不是WinNT才能提取用户的EmailAddress属性。再次从在线查看,似乎我需要知道用户所在的OU能够做到这一点。问题是我们的用户是通过许多不同的OU安排的,我无法预测通过代码的位置。


我要做的是获取每个人的电子邮件地址在特定的安全组中。我设法使用以下代码获取了几条信息。

展开 | 选择 | Wrap | 行号

解决方案

我相信您正在为LDAP查询寻找用户名而不是FullName。


好吧,基于ADezii在我引用的线程中发布的解决方案,sysInfo.UserName使用用户的全名以及我列出的其他元素的字符串。因此,虽然您准确地说使用的属性称为UserName,但它指的是用户的名称,而不是我正在寻找的计算机用户名。


这是一个VBScript我在工作中使用它来快速获取AD信息给出它们的名字和姓氏。您将感兴趣的部分是用于查找正确AD对象的过滤器,无论它们位于哪个OU中。

展开 | 选择 | Wrap | 行号

I have found the following thread which ADezii solved very nicely: ...Grab information from AD.... However, this just pulls for the current user. I want to be able to specify the user so that I can get their email address. From research that I have done online (ADSI Active Directory), you must use LDAP and not WinNT to be able to pull the EmailAddress property of the user. Again from looking online, it seems that I need to know the OU where the user is located to be able to do this. The problem is that our users are arranged through many different OUs and I can''t predict where via code.

What I''m trying to do is get the email addresses for everyone in a specific security group. I had managed to get several pieces of information using the following code.

Expand|Select|Wrap|Line Numbers

解决方案

I do believe you are looking for username and not FullName for the LDAP query.


Well, based on the solution ADezii posted in the thread that I referenced, the string that sysInfo.UserName uses the user''s full name along with the other elements I listed. So while you are accurate that the property used is called UserName, it refers to the user''s name and not the computer username that I''m looking for.


This is a VBScript that I use at work to grab AD info quickly given their first and last name. The part you''ll be interested in is the filter that is used to find the correct AD object regardless of which OU they are in.

Expand|Select|Wrap|Line Numbers


这篇关于查询特定用户的Active Directory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆