I want to query a AD server to get certain fields using VBScript or WSH script
These fields
- DN
- userid
- company
- displayName
And export/output the fields to a text file.
How can I accomplish that?
I came from linux background and need this as the computer that will run the script is running windows
Using linux,
`ldapsearch -x -h hostserver -b "cn=contacts,dc=support,dc=com" CN="name"`
Best Solution
The usual method is to use ADO and an LDAP query to retrieve information about AD objects:
As you can see there is a lot of boilerplate code involved, so I wrote this class (
ADQuery
) to simplify the handling. The README contains some examples.If you already know the distinguished name of an object you can also directly retrieve it like this: