Solved

Showing mailbox with different email domain alias

Posted on 2013-01-27
4
420 Views
Last Modified: 2013-04-15
Hi People,

Can anyone please assist me with the powershell script to display the mailbox with additional alias or different authoritative domain ?

I got a script here from one of the Experts-Exchange author jjmck:

$domain = ""
Get-Mailbox -ResultSize unlimited | % {
	foreach ($address in $_.emailaddresses) {
		If (($address.type -eq "SMTP") -and (($address.Address.Split("@")[1] -eq $domain))) {
			$_.emailaddresses -= [Microsoft.Exchange.Data.ProxyAddress]("smtp:$($address.address)")
		}
	}
	Set-Mailbox $_.primarysmtpaddress -EmailAddresses $_.EmailAddresses
}

Open in new window


the script above was to change any email address that has different authoritative domain. what I need is to know how many records first then do the changes so that my manager know how many mailboxes affected.

so if anyone please can assist me in modifying those script above that'd be greatly appreciated.

Thanks
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 37

Accepted Solution

by:
Jamie McKillop earned 500 total points
ID: 38827543
Hello,

If you just want a count, this will do what you want:

$domain = ""
$i=0
Get-Mailbox -ResultSize unlimited | % {
	$j=0
	foreach ($address in $_.emailaddresses) {
		If (($address.type -eq "SMTP") -and (($address.Address.Split("@")[1] -eq $domain))) {
			#$_.emailaddresses -= [Microsoft.Exchange.Data.ProxyAddress]("smtp:$($address.address)")
			$j++
		}
	}
	if ($j -ne 0) {$i++}
	#Set-Mailbox $_.primarysmtpaddress -EmailAddresses $_.EmailAddresses
} 
$i

Open in new window


JJ
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 38829071
thanks JJ,

I haven't tried that script yet as it is still on my way to the office. hopfully it should also displays the mailboxes with different mail domain as well.
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 38829830
JJ, why it only shows the number 0 as the result ?
I have changed the $domain = "mydomain.com"
0
 
LVL 8

Author Closing Comment

by:Senior IT System Engineer
ID: 39082781
Thanks !
0

Featured Post

Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

Question has a verified solution.

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

A hard and fast method for reducing Active Directory Administrators members.
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

739 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