Solved

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

Posted on 2016-10-14
1
41 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 500 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
how to add IIS SMTP to handle application/Scanner relays into office 365.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now