Summary: Dsquery is a powerful search command tool that can help you find users, or users with certain attributes. Below are some sample searches to give you an idea of how to use dsquery and it's syntax.
Example 1.
In this example, I want to find to export objects and who has ownership. For example, I want to find the owners of distribution lists that they can manage.
C:\Documents and Settings\JamesMVP>dsquery * -limit 200000 dc=corp,dc=mycompany,dc=com -filter "(&(objectclass=*)(objectcategory=*))" -attr displayname managedby > c:\managedby.txt
Example 2.
In this example, I want to list all users that are in a certain mailbox store using the homemdb attribute.
C:\Documents and Settings\JamesMVP>dsquery * dc=corp,dc=mycompany,dc=com -filter "(&(objectclass=user) (object category=person)(homemdb=CN=Mailbox Store (EX3),CN=First Storage Group,CN= InformationStore,CN=EX3,CN=Servers,CN=First Administrative Group,CN=Admini strative Groups,CN=DSTTEST,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC =corp,DC=company,DC=local))" -attr displayname > c:\mailboxes.txt
James Chong (MVP)
MCSE M+, S+, MCTS, Security+
msexchangetips.blogspot.com
ftp://ftp://ftp.smtp25.org//
How useful was this article? Want to see a tip not listed? Please leave a comment.
Example 1.
In this example, I want to find to export objects and who has ownership. For example, I want to find the owners of distribution lists that they can manage.
C:\Documents and Settings\JamesMVP>dsquery * -limit 200000 dc=corp,dc=mycompany,dc=com -filter "(&(objectclass=*)(objectcategory=*))" -attr displayname managedby > c:\managedby.txt
Example 2.
In this example, I want to list all users that are in a certain mailbox store using the homemdb attribute.
C:\Documents and Settings\JamesMVP>dsquery * dc=corp,dc=mycompany,dc=com -filter "(&(objectclass=user) (object category=person)(homemdb=CN=Mailbox Store (EX3),CN=First Storage Group,CN= InformationStore,CN=EX3,CN=Servers,CN=First Administrative Group,CN=Admini strative Groups,CN=DSTTEST,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC =corp,DC=company,DC=local))" -attr displayname > c:\mailboxes.txt
James Chong (MVP)
MCSE M+, S+, MCTS, Security+
msexchangetips.blogspot.com
ftp://ftp://ftp.smtp25.org//
How useful was this article? Want to see a tip not listed? Please leave a comment.