Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Newbie AD Query

  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie AD Query

    Hi Guys - This is my first post, I've found this forum useful in the past and I thought where better to go?

    At my workplace we have an in house automated system that takes a export of updates and new records from the HR databases. Our automated system then processes the exports and creates scripts to replicate these changes to active directory.

    Each user has 2 email addresses associated to their account, one with their username and one with their name. So [email protected] and [email protected]

    We have discovered that roughly 1250 of our 40000 accounts are missing the user id email address. I have managed to populate a list of the users with only 1 address from AD to a text file and I plan on creating the missing address via an Ldifde command.

    However my problem is that at the moment I only have the user id of these accounts, in order for me to proceed with an ldifde command I need to know the location of each of these accounts within the directory.
    IE dn:CN=hb0001,OU=ITS,OU=Staff,DC=domain

    I've managed to query active directory with my username and be given the directory location with the adfind query but I'm struggling to input the text file of 1250 users into the command.

    Essentially I would like a way of querying active directory to find the directory location of all 1250 users from the text file I have created that currently has user ids. Can anyone assist and suggest the best method to do this? I'm a complete noob when it comes to cmd based queries...

    I'm currently using adfind dc=domain -f cn=<username> on a windows 2003 server with Exchange 2003 installed.
    Last edited by Hasbeen; 8th December 2011, 16:05.

  • #2
    Re: Newbie AD Query

    I figured it out - not the most graceful of methods but I got there in the end

    I added the users to a distribution list and then used the command

    dsget group <distribution list location> -member -expand