I worked on a case recently where we wanted to automate solution 2 in this knowledge article:
I started with a script but decided to turn it into a cmdlet for easier reuse and elegance. Here's how to use the cmdlet:
- Start Exchange Management Shell.
- Dot-source the ps1 file so the cmdlet becomes a part of your shell: . c:\temp\Fix-IMCEAEX-NDR.ps1
- You can even get help on the cmdlet: Get-Help Fix-IMCEAEX-NDR -full
- Create a CSV file with two column headers: IMCEAEX and Account. Each line after should represent an account you want to fix.
- Run the command to generate a list of commands: Fix-IMCEAEX-NDR -csvFile "c:\temp\NDRs.csv" | Out-File commands.ps1
- Review the generated commands inside the outputted commands.ps1 file using a text editor like Notepad and edit them if necessary.
- Run the commands one-by-one by copying and pasting into EMS, or all of them at once by running the ps1 file.
Some information on "cleaning up" the IMCEAEX address: if your address has other escaped characters of the format +HH, simply look up the two characters after the + symbol in the ASCII table and find the HEX match. For example, +21 represents an exclamation point (!).
Hope this helps,