Solved

Query AD for users Email Address

Posted on 2004-10-12
2
179 Views
Last Modified: 2010-05-02
Is there a way to query AD for a single users email address if I know their Logon Name?

I use something like this in a script, but I'd like to know if I can just get the info for a single user:

Set objDomain = GetObject("WinNT://mydomainname.com,domain")
objDomain.Filter = Array("User")
For Each objUser In objDomain
......




0
Comment
Question by:robrandon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
Martone earned 125 total points
ID: 12290751
try this

Dim User
Dim UserName
Dim Domain
Domain = "domainname"
UserName = "username"
Set User = GetObject("WinNT://" & Domain & "/" & UserName & ",user")
wscript.echo User.Fullname
0
 
LVL 16

Author Comment

by:robrandon
ID: 12290865
I changed the User.Fullname to get the email address, but it works.  Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 1,067
Excel - Save a copy of work book 13 96
Automatic Email Reminder 4 94
transition to visual .net from vb6 5 81
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question