Powershell script to delete secondary smtp domains from mailbox
I been follow this steps
http://www.powergui.org/thread.jspa?threadID=11968
E.g one user named USER01, in this email address have followin email:
Primary: USER01@contoso.com
Secondary:USER01@fabrikam.com
EmailAddressPolicy is disabled.
So, I tried to remove Secondar email address using powershell. Howvever, when i did try in my enviroment, the cmdlet will remove all email address i
Please advice
April 21st, 2011 5:30am
what command from that link did you try from that webpage? can you post that here?
-join("74686979616775313440686F746D61696C2E636F6D"-split"(?<=\G.{2})",21|%{[char][int]"0x$_"})
http://www.myExchangeWorld.com
This posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
April 21st, 2011 6:55am
what version of exchnage is this?-join("74686979616775313440686F746D61696C2E636F6D"-split"(?<=\G.{2})",21|%{[char][int]"0x$_"})
http://www.myExchangeWorld.com
This posting is provided "AS IS" with no warranties, and confers no rights.
April 21st, 2011 9:38am
I tried several command like belows:
$email = $_.EmailAddresses | Where-Object {$_.PrefixString -ceq 'smtp' -AND $_.SmtpAddress -notlike
'*@fabrikam.com'}
Set-Mailbox USER01 -EmailAddresses $email
$email = $_.EmailAddresses | Where-Object {($_.PrefixString -cne 'smtp') -OR ($_.SmtpAddress -notlike
'*@fabrikam.com')}
Set-Mailbox USER01 -EmailAddresses $email
$email = $_.EmailAddresses | Where-Object {$_.SmtpAddress -notlike
'*@fabrikam.com'}
Set-Mailbox USER01 -EmailAddresses $email
But all command will remove email addresses
Free Windows Admin Tool Kit Click here and download it now
April 21st, 2011 11:58pm
Exchange 2007 SP2
April 21st, 2011 11:58pm
Hi Suriya,
You can see below article:
http://social.technet.microsoft.com/Forums/en-NZ/exchangesvradmin/thread/4ca1f6dd-07a9-44ac-a32f-f63d42cfc7d1Anil
Free Windows Admin Tool Kit Click here and download it now
April 22nd, 2011 4:13am
Hi,
I have tested, it worked for Exchange 2010, it should be worked for Exchange 2007.
[PS] C:\Windows\ System32 >$1=Get-mailbox –identity
aaa
[PS] C:\Windows\ System32 >$2=$1.Emailaddresses
[PS] C:\Windows\ System32 >$2
[PS] C:\Windows\ System32 >$2 -=(“smtp:second@domain.com”)
[PS] C:\Windows\ System32 >$2
[PS] C:\Windows\ System32 >set –mailbox –identity aaa –EmailAddresses $2.emailaddresses
Please 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. This can be beneficial to other community members reading the thread.
April 25th, 2011 2:15am
if i used:
C:\ps> $2-=("smtp:*@mydomain.com") - it will not remove the secondary email
but if
C:\ps> $2-=("smtp:e3barge@mydomain.com") - it will remove the secondary email
please advice.
April 26th, 2011 4:09am
As research in TechNet, I haven’t found any article about using wildcard to add or remove an e-mail address for a mailbox.
I think, if you want to add or remove Email address for most of users, you could use E-mail Address policies.
Edit an E-Mail Address Policy
If you want to add or remove Email address for a special user, you don’t need to use wildcard.
http://technet.microsoft.com/en-us/library/bb123794.aspx
Please 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. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
April 26th, 2011 11:01pm