Help with Script to amend msExchExtentionCustonAttribute requested RRS feed

  • General discussion

  • We currently use msExchExtentionCustomAttribute 1 and 2 to populate each mailbox users email address for processing.

    The email addresses are in the format firstname.surname @ domain.com and populate both custom attribute 1 and 2

    Due to a domain change I need to amend just the domain part and leave the other details the same.

    So Jo.Bloggs @ happy.com to change to

    Jo.Bloggs @ sad.com

    I need to do this for all our mailbox users (900 of them), can anyone help?

    Massive thanks in advance if someone knows how to do this.


    • Edited by r0b3rt1976 Tuesday, June 19, 2018 12:16 PM
    • Changed type Bill_Stewart Monday, July 30, 2018 9:39 PM
    • Moved by Bill_Stewart Monday, July 30, 2018 9:39 PM This is not "scripts on demand"
    Tuesday, June 19, 2018 12:03 PM

All replies

  • You can use a regular expression. Here's an example you can run directly from thew PowerShell prompt:

    PS C:\> 'Jo.Bloggs@happy.com' -replace '([^@]+)@happy\.com','$1@sad.com'

    -- Bill Stewart [Bill_Stewart]

    Tuesday, June 19, 2018 3:54 PM
  • Thanks very much  Bill,

    The complication I have is that although msExchExtentionCustomAttribute 1 and 2 contain domains names that I need to change, the domains in these attributes are not the same as the email domain that we send from, they are not the same as the default email address, although they the same as a proxy address that we use from days of old.

    Will your suggestion still work and only amend the msExcchExtentionCustomAttributes that I need to update?

    I hope that makes sense but we have change systems so many times it is a little complicated.

    Tuesday, June 19, 2018 4:26 PM
  • My example shows how to perform textual substitution of an email address using a regular expression.

    For the actual implementation, you can incorporate similar code into your existing script.

    If you don't have an existing script: This is not the place to ask others to write a script for you. Please read the following:

    This forum is for scripting questions rather than script requests

    You are free to post a request on the request page, but there's no guarantee that someone will do it for you (the help is free, after all).

    If this is critical to your business, we'd recommend hiring a consultant.

    -- Bill Stewart [Bill_Stewart]

    Tuesday, June 19, 2018 7:11 PM