Posted by: Colin Smith
Exchange, Exchange Scripting, Powershell, Scripting
Another thing that I have found is that you are not able to change the primary smtp address for a mailbox if the mailbox has the emailaddresspolicyenabled flag set to true. Since in my case we want all uses to conform to the new standard, if the script determines that the Primary address needs to be changes I will have to set that flag to false and then make the change. I will not be changing that flag back to true because then the Primary Address will go back to what the policy thinks it should be and not what I really want it to be. Setting the $erroractionpreferece variable to “Inquire” helped me figure out that was happening. By default Powershell will let you know an error occured but will continue processing. I had output pushing to the screen to make sure that my filtering was working correctly so the errors did not stay on the screen long enough for me to see what they were. This option helped a lot.