Exchange Server Share

… Information sharing on Exchange Server …

Exchange Powershell Tip #10

leave a comment »

Exchange Powershell Tip #10

Find list of mailboxes which are having more than one primary SMTP address in an Exchange environment.

A mailbox can have only one Primary SMTP address, if it has more than one then it is not inconsistent state. You would get a warning message anyway in Exchange Management Shell when Shell tries to get information about the mailbox.

However if you want to find the list of mailboxes with more than one primary SMTP address in your environment then you can use below cmdlet.

ForEach ($Mailbox in (Get-Mailbox -ResultSize Unlimited)) { If(($Mailbox.EmailAddresses|Where{$_.PrefixString -ceq “SMTP”}).count -gt 1) {Write-Host $Mailbox.DisplayName “has multiple primary SMTP addresses”} }

Sample output:

#10-1

Now if you want to export the list of users into a text file then you can export using this cmdlet.

ForEach ($Mailbox in (Get-Mailbox -ResultSize Unlimited)) { If(($Mailbox.EmailAddresses|Where{$_.PrefixString -ceq “SMTP”}).count -gt 1) {$Mailbox.DisplayName | Out-File c:\temp\test.txt -Append } }

==> Get All Exchange Powershell Tips from the Archive Here<==

Written by Amit Tank

July 27, 2016 at 10:07 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: