Exchange 2013 Powershell Help

Platform: Exchange 2013 Powershell

Hello,

I would like to use Exchange Powershell to give me a list of all people that are in an Exchange Database in a specific format.  
For instance, I would like the command to show me "Here are the employees that are in Database1".  Here are the 2 requests:
1.  It needs to be exported to a CSV file
2.  It needs to show their email address, first name, last name, username, and display name.  

Any help would be greatly appreciated!  Thank you.
zito2000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

timgreen7077Exchange EngineerCommented:
You can run the following:

Get-Mailbox -Database "database" -ResultSize unlimited | select name, displayname, alias, PrimarySmtpAddress, database | Export-Csv c:\temp\results.csv
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MAS (MVE)EE Solution Guide - Technical Dept HeadCommented:
HI zito2000,
Get-Mailbox output does not have properties called  firstname & lastname. You have to try with get-recipient. Please try below.
Get-Recipient | select primarysmtpaddress,firstname,lastname,alias,displayname | Export-Csv c:\temp\mailboxdetails.csv

Open in new window


Thanks
MAS
1
timgreen7077Exchange EngineerCommented:
Get-mailbox will display user first and last name unless your are talking about first name column and last name column. The cmdlets i provide will satisfy the author's request, including searching specific DB.
0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

zito2000Author Commented:
Both of these were extremely helpful, thank you both!!
I ended up using MAS' command because of the first name/last name separation, but TimGreen's worked like a charm as well to break up by database.
0
MAS (MVE)EE Solution Guide - Technical Dept HeadCommented:
Glad to know Timgreen's command helped.

@Timgreen
Thanks for being on-board.
I didnt mean your command is wrong. We both commented the same time.
Ultimately asker's requirement is met. This is the objective here.
1
timgreen7077Exchange EngineerCommented:
Agreed and thank you also.
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.