Exchange 2013 Powershell Help

zito2000
zito2000 used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Exchange Engineer
Distinguished Expert 2018
Commented:
You can run the following:

Get-Mailbox -Database "database" -ResultSize unlimited | select name, displayname, alias, PrimarySmtpAddress, database | Export-Csv c:\temp\results.csv
MASEE Solution Guide - Technical Dept Head
Most Valuable Expert 2017
Commented:
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
timgreen7077Exchange Engineer
Distinguished Expert 2018

Commented:
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.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

zito2000Network Manager

Author

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.
MASEE Solution Guide - Technical Dept Head
Most Valuable Expert 2017

Commented:
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.
timgreen7077Exchange Engineer
Distinguished Expert 2018

Commented:
Agreed and thank you also.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial