Remove redundant SMTP addresses from Mailboxes

Hi,
I have to bulk edit some mailboxes which should have mydomain.com and mydomain.mail.onmicrosoft.com (and any other verified domains)
We have some mailboxes that have [email protected] and
[email protected] and
[email protected]. this is the same format for 2 other domains ie first.last at xyz.com
I thought if I did the following it would do the trick but its not working, please can someone help me.
foreach($user in $list)
$a = "*@aaaa.co.uk"
$b = "*@bbbb.co.uk"
$c = *@cccc.com
  $user.EmailAddresses |
    ?{$_.AddressString -like $a} | %{
      Set-Mailbox $i -EmailAddresses @{remove=$_}

Hi Ed,
Unfortunately that wont work as this would replace all addresses, even those that we don't want to manipulate.
I got it working in the end.. if anyone gets this again, then please following something like below:
# This creaetes a simple list of users.
$list=@()
$list = @()
$list += (get-mailbox 0365Test2)
$list += (get-mailbox 0365Test3)
$list += (get-mailbox 0365Test4)
$list += (get-mailbox 0365Test5)
$list += (get-mailbox 0365Test6)
$list += (get-mailbox 0365Test7)
$list += (get-mailbox 0365Test8)
$list += (get-mailbox 0365Test9)
$list += (get-mailbox 0365Test10)
# REMOVE DOMAIN1
foreach($dom1 in $list)
  $dom1.EmailAddresses |
    ?{$_.AddressString -like '*@domain1.sch.uk'} | %{
      Set-Mailbox $dom1 -EmailAddresses @{remove=$_}
# REMOVE DOMAIN2
foreach($dom2 in $list)
  $dom2.EmailAddresses |
    ?{$_.AddressString -like '*@domain2.org.uk'} | %{
      Set-Mailbox $dom2 -EmailAddresses @{remove=$_}

Similar Messages

  • Easily remove an SMTP address that has been applied by a Email Address Policy?

    Hello,
    How can I remove an SMTP address that has been applied to all users mailboxes and distribution lists?
    Thanks

    Hi,
    You can use "Email Address Policy" to manage all of the user's SMTP address.
    For Exchange 2003:
    How to Modify an SMTP E-Mail Address by Using Recipient Policies
    For Exchange 2007:
    Managing E-Mail Address Policies in Exchange Server 2007
    For Exchange 2010:
    Remove an E-Mail Address Policy
    Hope this helps!
    Thanks.
    Niko Cheng
    TechNet Community Support

  • How do you remove a web address from compatibility view option using a script?

    How do you remove a web address from compatibility view option in IE using a script or a GPO? 
    Not seeing any options.
    Casey
    This topic first appeared in the Spiceworks Community

    luckyfromhialeah wrote:
    How do you remove a web site from popular list?
    If you mean from the Safari menubar item "Popular"
    Choose "Show All Bookmarks" from the Bookmark menu in the main menubar, or click the icon for that in Safari's menubar -
    The page that opens should show a list of Bookmarks. In the Left column, click the item under Collections named Bookmarks Bar.
    In the new view, locate the folder named Popular and click the reveal triagle to the left of its name - it will open and reveal all the items listed in Popular.
    Find the one you want to remove, click it once to select it, then press the Delete key on the keyboard.

  • How do I remove an email address from my icloud memory?

    I would like to remove an address from my icloud memory? For example I will type in the first two letters and icloud automatically brings up that email address.
    How do I remove it or lose it?

    If you haven't already removed the email address from your contacts in cloud, you may want to start there.  If that doesn't work, then you may be out of luck.  Unfortunately, smartphones remember things we don't want them to :-(

  • How can I remove my email address from the lock screen?

    How do I remove my email address from the lock screen? My dad bought me a new laptop after mine was stolen from my house on New Year's Eve. I'm a little tighter on my security now and when I turn on my laptop the lock screen shows me my name and my email
    address. If my laptop gets stolen again, I don't want my email address to be displayed for someone to use or sell as I'm extremely picky about what I'm giving out my email for. If there isn't a way to hide my email address, I'm going to demand a "downgrade"
    from this Windows 8 s**t and back to the more user-friendly and less confusing Windows 7. (And for the record, I hate Windows 8. With a passion.)

    Hello,
    The TechNet Wiki Forum is a place for the TechNet Wiki Community to engage, question, organize, debate, help, influence and foster the TechNet Wiki content, platform and Community.
    Please note that this forum exists to discuss TechNet Wiki as a technology/application.
    As it's off-topic here, I am moving the question to the
    Where is the forum for... forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • How do you remove old email addresses from the invitee drop down menu in Calendar

    How do you remove old email addresses from the invitee drop down menu in Calendar

    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Caches/com.apple.iCal/Previous Recipients.plist
    Right-click or control-click the line and select 
    Services ▹ Reveal
    from the contextual menu.* A folder should open with an item selected. Quit the application if it's running. Move the selected item to the Desktop, leaving the window open. Relaunch the application and test. If there's no change, quit again and put the item you moved back where it was, overwriting the one that may have been created in its place. Otherwise, delete the item you moved.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • Reset phone to factory settings to remove unwanted email addresses from autofilling.  Now trying to only sync real contacts, photos, and apps from backup.  HELP PLEASE!  :)

    Reset phone to factory settings to remove unwanted email addresses from autofilling.  Now trying to only sync real contacts, photos, and apps from backup.  HELP PLEASE! 

    All of this should be on your computer as you should be syncing regularly to your computer.. Just sync it back.
    iPhone User Guide (For iOS 4.2 and 4.3 Software)

  • Bloo ,,,, Please remove my MAC addresses from hardcoded server redirect list

    Bloo
    Have sent multiple PM's in reply and told you that system was updated and politely asked you remove my MAC addresses from bypass list so that normal updates can be applied.
    Solved!
    Go to Solution.

    Thanks Yogapad. I'll let bloo know about it. Please PM me your Mac Address to get things fixed faster.
    Cheers,
    Cleo
    WW Social Media
    T61, T410, x240, Z500, Flex 14
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    How to send a private message? --> Check out this article.
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • How can I remove an email address from one apple account and associate it with another?

    I created an appleID account to use with the mac AppStore without realising i previously had an appleID account from my first iPod touch.
    Now with OSX 10.8 I want to use the email address from the old account with the new account for Messages.app without having to manage 2 logins.
    I've followed the steps found on the support page http://support.apple.com/kb/HE68 under the section "How to add an additional email address that is already associated with another Apple ID" but each time I attempt to add the removed email address from the new account to the old account the input box shows the error: Email address is already verified for another Apple ID.
    Has anyone else experienced this problem and found a solution?

    Click here and request assistance.
    (80443)

  • How do I remove an email address from an account?

    Every time I turn my iphone off and on again, it asks me to log into icloud and other apps that I set up with an old email address. That old email address has now been removed from my itunes account and replaced, and I no longer use the old one at all. However, when I go into my itunes account, it doesn't say anything about my old email address still being on there. How do I remove my old email from icloud without losing my apps or my current itunes account details?

    Just what did you do? There is only one email address for one Apple ID but yo can have an alternate email address to use to contact Apple.

  • How do I remove an email address from a workflow notification?

    Hi, I was wondering if you could help me please. Can you tell me how to remove an old email address from a workflow notification? The person's name and email address have already been removed from the list of Users in the Admin area, but some workflow notifications are still being sent to their email. Any ideas?
    Many thanks for your help.

    Thanks Liam, I'd previously looked at the also notify field and it didn't show any other email addresses. This time I clicked on the second of my two options in the Workflow Steps field, and then clicked back on the first one  again, and hey presto, two email addresses appeared! The offending email address has now been removed.
    Thanks again for your help. Cheers!

  • How do I remove an email address from the imessge in settings?

    When i sent an imessage to one of my contacts who is also an owner of the iphone, she says that I am sometimes sending it via email.  I went into settings and then to messages and I have 2 addresses, one of them is my email address.  I now want to remove my email address as it  seems to be causing me problems.  How do I remove my email address?  I am aware that i touch "Receive At" which has 2 addresses, but I am wanting to remove the email address but nothing is happening.  Help!

    You're welcome.
    If that email address is your Apple ID, I don't believe you can delete it.
    If you have your cell phone number selected as your Caller ID, when sending an iMessage it will be sent from your phone number.
    Since your Apple ID email address is registered as well, if someone has your email address in their contacts, they can select your email address to send you an iMessage in addition to your phone number.
    When this recipient says you are sometimes sending an iMessage via email, it is received as an email with the Mail app on their iPhone, not with the Messages app?

  • Giving users control of their own distribution list control to add or remove external email addresses from their list

    We are a Exchange 2010 SP3 shop, we have distribution groups (with over 200 email addresses ) from another email system which has only external email addresses (i.e [email protected] [email protected]  and so on …..)
    We want to import these groups into exchange. we called microsoft, they said create mail contacts for each address and put those in a Distribution Group.  I know this will work. 
    Our goal is to have the user create / maintain / add / remove external their own email addresses  (Not the IT department)
    There must be many companies whose requirements match ours. Are there third party tools that would handle creation of distribution list? 
    Any constructive advice would be greatly appreciated ! THank you

    I wouldn't give the ability to create contacts to everyone in the environment because it will become mess at some point of time and IT will have to jump to control it
    anyway so why don’t from the start...
    I would give this to certain people like Leads or Managers of the groups under certain IT Policy so it will be still under control and people
    will think before asking their superior to create them and someone gets responsibility to manage these contacts...
    Though here is the more specific article on how to delegate creating and editing contacts...
    Creating RBAC Role To Delegate
    Editing Contacts
    Blog |
    Get Your Exchange Powershell Tip of the Day from here

  • Remove Bogus Email Addresses from Address-Completion Cache?

    Clearly Apple's Email program retains a small cache of Email addresses for address-completion purposes as you type in addresses on the To or Cc lines.
    Is there a way to remove bogus addresses from that cache?
    A few folks have long since moved to different addresses, and it keeps popping up their ancient addresses...

    From your Mail menu choose Window > Previous Recipients, delete whatever you like.
    -mj

  • Removing my postal address from all mailing lists

    I recently moved house and no longer have a BT service. I am looking to remove my address from all postal mail - how can I do this?

    Have a look at these links they may help you.
    http://www.shop.bt.com/articles/help/managing-your-account/how-do-i-remove-myself-from-your-mailing-...
    http://www.btplc.com/privacypolicy/privacypolicy.htm
    http://www.tpsonline.org.uk/tps/index.html

Maybe you are looking for