Link to home
Start Free TrialLog in
Avatar of Albert Widjaja
Albert WidjajaFlag for Australia

asked on

Showing mailbox with different email domain alias

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
ASKER CERTIFIED SOLUTION
Avatar of Jamie McKillop
Jamie McKillop
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Albert Widjaja

ASKER

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.
JJ, why it only shows the number 0 as the result ?
I have changed the $domain = "mydomain.com"
Thanks !