The last time I did this, it actually had to be done in two steps. If the only 
difference is a change-in-case, I don’t think Set-Mailbox will process the 
change.

But that was way back on Exchange 2007 I think, it may have changed since then.

From: [email protected] [mailto:[email protected]] On 
Behalf Of Knoch, James W
Sent: Friday, April 15, 2016 4:15 PM
To: [email protected]
Subject: [Exchange] RE: I have an email policy that is applying the .com in 
uppercase.

You can grab a user’s mailbox into a variable.  Then walk the EmailAddresses 
property and pull them out as ProxyAddressString and save that into a string 
array.

Then walk that array and split each SMTP address at the “@” and then replace 
what you need replaced (on either side), then add that into a different string 
array.  Then take that renamed array and save it over the “-EmailAddresses” 
with Set-Mailbox.

Since you’re using EmailAddressPolicies, you will have to disable them 
temporarily on that object in order to be able to set the EmailAddresses.

I wrote something similar yesterday as a test for just changing Primary Email 
Addresses.  Note that the code with “Get-Culture” will capitalize the left side 
of the address and domain suffix will be made all lowercase.  It keeps all 
X500, SIP, X400 and all other address types since it is currently only looking 
to modify the Primary SMTP.

Obviously modify and test accordingly…

$Mailbox = Get-Mailbox SomeUser

$TempAddresses = @()
$RenamedAddresses = @()

foreach ($Address in $Mailbox.EmailAddresses) {

    $TempAddresses += $Address.ProxyAddressString

}

foreach ($Address in $TempAddresses) {

    if ($Address -cmatch "SMTP") {

        $OldUserAddress,$DomainSuffix = $Address.Split("@")
        $DomainSuffix = $DomainSuffix.ToLower()
        $NewUserAddress = (Get-Culture).TextInfo.ToTitleCase($OldUserAddress)

        $RenamedAddresses += "$($NewUserAddress)@$($DomainSuffix)"
    }
    Else {
        $RenamedAddresses += $Address
    }

}

Set-Mailbox $Mailbox -EmailAddresses $RenamedAddresses 
-EmailAddressPolicyEnabled $False -WhatIf



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Kennedy, Jim
Sent: Friday, April 15, 2016 12:50 PM
To: [email protected]<mailto:[email protected]>
Subject: [Exchange] RE: I have an email policy that is applying the .com in 
uppercase.

What if you deleted it and re-created it…really really quick.  ☺

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Michael B. Smith
Sent: Friday, April 15, 2016 1:47 PM
To: [email protected]<mailto:[email protected]>
Subject: [Exchange] RE: I have an email policy that is applying the .com in 
uppercase.

Applying updates are not case sensitive, as you’ve discovered.

Your only option is to edit the users manually. Use PowerShell. ☺

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Paul Cookman
Sent: Friday, April 15, 2016 9:50 AM
To: [email protected]<mailto:[email protected]>
Subject: [Exchange] I have an email policy that is applying the .com in 
uppercase.

Hi all,

I have an email policy that is applying the .com in uppercase. I have changed 
the case of the accepted domain which is now showing within the email policy 
correctly.

When applying though, it doesn’t seem to update the users to lowercase. Only 
when I edit the user manually does it update.

Any ideas?

Regards,

Paul.




Paul Cookman

Internal Systems Manager

Email:

[email protected]<mailto:[email protected]>

Tel:

+447957168744

Tel:

+448448741000

Web:

www.CORETX.com<http://www.CORETX.com>


[Image removed by sender. CORETX]<http://www.coretx.com>





Follow CORETX

Visit our Media Centre<http://www.CORETX.com/media-centre>



This email has been sent by and on behalf of CORETX Holdings plc, a public 
company registered in Scotland (company number SC368538) with registered office 
at 24 Dublin Street, Edinburgh, EH1 3PP ("CORETX"), and its subsidiaries. 
Information in this email including any attachment is confidential, may be 
privileged and is intended solely for the addressee. Unauthorised recipients 
are requested to preserve the confidentiality of this email, advise the sender 
immediately of any error in transmission, and then delete the email without 
making copies. Any disclosure, copying, distribution or action taken, or 
omitted to be taken, in reliance upon the contents of this email by 
unauthorised recipients is prohibited and may be unlawful. Any communications 
with CORETX may be monitored and a record may be kept.vNo contracts or 
commitments may be concluded on behalf of CORETX or its group companies by 
means of email, and no statement or representation made in this email is 
binding on behalf of CORETX.
DISCLAIMER: Whilst this message has been scanned for viruses, CORETX disclaims 
any responsibility or liability for viruses contained therein. It is therefore 
recommended that all emails should be scanned for viruses upon receipt.

________________________________

______________________________________________________________________
This email has been scanned by CORETX Ltd using the Symantec Email 
Security.cloud service.
______________________________________________________________________

Reply via email to