Removing email addresed
Hello,
I am having Exchange 2007 setup.I wanted to remove domain e.g. abc,com from all user SMTP address. By default we have two SMTP domain pqr.com & xtz.com in email address policy.
So can anyone provide me command to get all user on which default email address policy is not enabled & remove SMTP address abc.com.
Thanks in advance. Let me know you need more explanation on it.
July 29th, 2011 8:45am
To find mailboxes who has the heck box "Automatically update e-mail addresses based on email address policy" unchecked
$CheckNonAutoEnabled = Get-Mailbox -ResultSize Unlimited
$CheckNonAutoEnabled | where{$_.EmailAddressPolicyEnabled -eq $False} | ft displayname
Free Windows Admin Tool Kit Click here and download it now
July 29th, 2011 9:24am
In order to remove specific MTP address for bulk users, I don’t recall Command shell but you can achieve this using Admodify tool
Using ADModify - A real world example
http://exchangeis.com/blogs/exchangeis/archive/2005/07/01/using-admodify-a-real-world-example.aspx
Download
ADModify.NET
http://admodify.codeplex.com/
July 29th, 2011 9:30am
Hello Ramesh,
Thanks for your help.Basically i am looking for doing it through powershell way.
Does anyone knows how to remove a SMTP domain alias from all users except email address policy enabled users.
e.g get-mailbox | ? {$_.emailaddresspolicyenabled -eq $false} & pipe this to search for any SMTP domain abc.com match & remove it for each.
Free Windows Admin Tool Kit Click here and download it now
July 29th, 2011 9:46am
Hi Mango_Derek,
With Lasse Petterssons script you will get your job done.
Blog:
Remove proxyaddresses powershell script
BUT, read the comments cause the script was created for Exchange 2007 and needs some modification to work.
Thankfully Justin Guys has already done that for you. His version for the script works like a charm.
TIP: Change the first line
From: $mailbox = Get-Mailbox
To: $mailbox = (Get-Mailbox | where {$_.EmailAddressPolicyenabled -like "False"})
Enjoy, MartinaPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question.
July 29th, 2011 2:19pm
Hello Martina,
Thanks for ur help & thanks to Lasse Petterssons. I have already followed the article by Lasse Petterssons & managed to achieve it. Tested the script & worked well. Find below script for everyone's refference.
Get-Mailbox | ? { $_Emailaddresspolicyenabled -eq $false } |
foreach {
for ($i=$_.EmailAddresses.Count; $i -ge 0; $i--)
{
$address = $_.EmailAddresses[$i]
if ($address.SmtpAddress -like *@xyc.com )
{
Write-host("Remove smtp adress: " + $address.AddressString.ToString() )
$_.EmailAddresses.RemoveAt($i)
}
}
$_ | set-mailbox
}
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2011 8:17am
Thank you.
/Lasse
lasse at humandata dot se, http://anewmessagehasarrived.blogspot.com
July 30th, 2011 12:36pm