Pardon my ignorance, I do not know much about AD (let lone querying with AD or googling for that). I would like to get a list of all the users in a particular domain, their first name, last name and email ids. Would a network admin (or help desk in my case) be able to do that ? My other option: I have the usernames in an excel sheet, Full name in another text file (amongst other data – say XXXyy , FirstName LastName- I would have to split,parse it to extract the name) and email in another file and none of them are in order. There might be some missing data too 🙁
What would be the best way to go about it with Querying AD ?
Edit:May be I should be more specific. If I was seeing what my network admin would be doing to get me this info, what would he be doing ?
Active Directory exposes query interface via OLE DB and ADO. The provider is "ADsDSOObject", the query syntax goes like this:
<LDAP://mydomain.com>;(objectType=user);givenname,snPerversely, the URL schema name
LDAPmust be capitalized.Excel does not have a built-in ADO client, unless you code in VBA.
UPDATE: wrote a simple JavaScript query script for you:
It queries the fiest and last name of all users in your domain. Place your domain name in the third line. Then save it as a .js file, and execute thusly:
And you’ll end up with a text file called a.txt, with the names of your users, comma-separated. Import it into Excel or something.
In Excel, if you are willing to mess with macros, you can write a VBA function against ADO that performs the same query. Or use .NET’s
DirectorySearcher, recent versions of Excel let you consume .NET objects.