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

x
?
Solved

PowerShell Script to find number of Mailboxes per Mailbox Database plus SMTP Addresses

Posted on 2016-10-14
1
Medium Priority
?
61 Views
Last Modified: 2016-10-14
Hi,

Can you please assist me, I need a PowerShell Script that finds the number of Mailboxes per Mailbox Database plus the SMTP addresses for the Mailboxes. I'll need this for just one Mailbox Database. Thanks
0
Comment
Question by:makel2
1 Comment
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 41843571
To get mailbox count of a database..
(Get-Mailbox -ResultSize Unlimited -Database TempDatabase | Measure).Count

Open in new window

To get all mailbox email address details use following command..
Get-Mailbox -ResultSize Unlimited -Database TempDatabase | Select DisplayName,PrimarySmtpAddress, @{N="EmailAddresses";E={$_.EmailAddresses |? {$_.PrefixString -ceq "smtp"} | %{$_.SmtpAddress}}}

Open in new window

To Export details to CSV file
Get-Mailbox -ResultSize Unlimited -Database TempDatabase | Select DisplayName,PrimarySmtpAddress, @{N="EmailAddresses";E={$_.EmailAddresses |? {$_.PrefixString -ceq "smtp"} | %{$_.SmtpAddress}}} | Export-CSV C:\temp\report.csv -nti

Open in new window

2

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
Screencast - Getting to Know the Pipeline
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question