Queries with ADUC

Active Directories Users and Computers is a basic tool of a Windows 2003 Active Directory environment. An often overlooked feature is the saved queries in ADUC. There is some information floating around but it's something I never really used much until recently. Also, getting a group membership to list is not intuitive and I had to get some help fro our friendly neighborhood resources to find out how to do that.

First, because I admin Exchange, we want to find all the users on a given Exchange Store.

  • Open up Active Directory Users and Computers
  • Under Saved Queries right click and select New -> Query
  • Give it a name: Users on mailbox store X
  • In Find select Exchange Recipients
  • Uncheck everything except 'Users with Exchange mailbox'
  • Select the Storage tab
  • Check the 'Mailboxes in this mailbox store' radio button and browse to the stores you want.
  • Click OK

So the next one is a little harder. You want to find all the members of a given distribution list. Why you ask? Well, perhaps all the users are on different stores and you want to move them or you just want the group membership.

  • So under Saved Queries right click and select New -> Query
  • Give it a name: members of x list
  • Click 'Define queries'
  • Under find select 'Custom Search'
  • In the Custom Search tab select the 'Field' box and go to Users -> Member Of, Condition Is (Exactly), Value....
  • Here's where it gets annoying. You need to have the Distinguished name of the group you want to search. So if your domain and OU structure looks like
    test.ent
    -someOU
    --Distribution lists
    ----TeamDl
    You would have a member list CN=\TeamDL,OU=Distribution lists,OU=someOU,DN=test,DN=ent

  • So add the value CN=\TeamDL,OU=Distribution lists,OU=someOU,DN=test,DN=ent
  • Save everything

Run the query.

Hi, I need to create a query

Hi,

I need to create a query in AD to draw a list of all the servers we have in our organization which consist of Domain controllers and non-domain controllers and windows 2000 and 2003 servers. Is there a way to write a code to do it all?

Thanks and Regards
Farshad

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3> <blockquote> <img>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <posh>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options