[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 452
  • Last Modified:

Need help creating query for all mail users in our domain

I have a department that needs an Excel spreadsheet of all users with a mailbox in our domain.  preferably Full name (account name/logon name won't help them) and exchange mail address. i need either a query in AD Users and Computers with instructions how (to include how to put in excel) or a command line query exporting to excel.  i do not know/use Powershell, so i would need this in the form of a dsquery, dsget, etc so i can run it off of my command line.  i tried a query but it ran/hung for over a day so i'm assuming something was wrong.  we have about 2000 users in our Exchange 2003 domain.  thanks.
0
JodyBear
Asked:
JodyBear
  • 4
  • 4
1 Solution
 
Exchange_GeekCommented:
dsquery.exe * -filter "(&(objectClass=user)(!(objectClass=computer)(sAMAccountName=username)))" | dsget user -email -samid -display

See if this helps.

Regards,
Exchange_Geek
0
 
JodyBearAuthor Commented:
thanks for the prompt response.  i copied/pasted the command from your entry to ensure the syntax is correct and got the following:

dsget failed:`Target object for this command' is missing.
type dsget /? for help.

whatcha think?
0
 
Exchange_GeekCommented:
My bad this wont get the data from entire AD

Use the following.

csvde -r "(&(objectClass=*)(proxyaddresses=*))" -l displayname,proxyaddresses -f Data.csv

Regards,
Exchange_Geek
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
JodyBearAuthor Commented:
i'm sorry.  i did the first query from my computer and it didn't run, however it ran from my DC.  the second (csvde) gave me MUCH more info than i need in the form of CNs, distro groups, etc. that is not really usable for who it's goin to without going 1 by 1 through the list to remove invalid entries...

can you please relook the first one with dsquery, i got:

Williamsp      Cn=Williams\\..., WIlliams,Perry, Ou=Creation,Dc=xxx,Dc=xxx,Dc=xxx      Williams, Perry      Williams      Perry      Communications Specialist - 950344

which is PERFECT, but it only gave me 800+ users in the domain when i know i have 2000+.  know what we may need to change to get it to show all users in the domain?
0
 
Exchange_GeekCommented:
csvde -r "(&(objectClass=user)(proxyaddresses=*))" -l displayname,proxyaddresses -f Data.csv

Try this meanwhile I am looking into dsquery cmdlet

Regards,
Exchange_Geek
0
 
JodyBearAuthor Commented:
thank you so much.
0
 
Exchange_GeekCommented:
Did csvde help?

Regards,
Exchange_Geek
0
 
JodyBearAuthor Commented:
helper was responsive and provided a good result.
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now