locked
PS Script to Upgrade Mail Contacts to 2010 RRS feed

  • Question

  • We recently migrated from Exchange 2007 to Exchange 2010 SP1 and want to upgrade all existing mail contacts to Exchange 2010 contacts. From what I can tell, all that this really entails is to update the attribute 'msExchVersion to be the value of '44220983382016.' I tried the following to try and force the contact to be upgraded to Exchange 2010 and neither set the msExchVersion appropriately:

    $DataTable = Get-MailContact -Resultsize:Unlimited  -Filter {ExchangeVersion -ne 44220983382016}
    $DataTable | ForEach-Object {$_| update-Recipient}

    and

    $DataTable = Get-MailContact -Resultsize:Unlimited  -Filter {ExchangeVersion -ne 44220983382016}
    $DataTable | ForEach-Object {$_| set-MailContact -EmailAddressPolicyEnabled:$False -ForceUpgrade}

    The only workarounds I have found so far is to actually modify an attribute on the mail contact to force the upgrade like the example below and then go back and clear the value on custom attribute which is a real PIA or to simply write the value '44220983382016' directly to the msExchangeVersion attribute.

    $DataTable = Get-MailContact -Resultsize:Unlimited  -Filter {ExchangeVersion -ne 44220983382016}
    $DataTable | ForEach-Object {$_| set-MailContact -CustomAttribute1 "Updated" -EmailAddressPolicyEnabled:$False -ForceUpgrade}

    I'm thinking there has to be an easy way to do this with using the Exchange 2010 shell as I can't be the only one to ever come across this. If it can't be done via PowerShell without modifying the mail contact, is it supported to directly modify the msExchangeVersion attribute?

     

    Wednesday, January 18, 2012 1:34 PM

Answers

  • I'm thinking there has to be an easy way to do this with using the Exchange 2010 shell as I can't be the only one to ever come across this. If it can't be done via PowerShell without modifying the mail contact, is it supported to directly modify the msExchangeVersion attribute?

    Hi,
    I haven't got -Forceupgrade to work on mailcontacts either so I have also used the "method" of changing an attribute.

    Example:
    Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 Update
    Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 $null


    Martina Miskovic
    • Marked as answer by final_round Tuesday, April 10, 2012 3:14 PM
    Wednesday, January 18, 2012 9:55 PM

All replies

  • I'm sure you've already tried this, but just in case, have you tried simply running?

    Get-MailContact -Resultsize:Unlimited  -Filter {ExchangeVersion -ne 44220983382016} | Set-MailContact -ForceUpgrade

    Does that simply produce a warning stating that nothing has been updated or does it help?

    I can't test this myself as we're not in a migratory position, but if that doesn't help then there are alternatives to explore.

    Cheers,
    Lain

    Wednesday, January 18, 2012 1:44 PM
  • I have tried that and you are correct - you get the warning stating no settings have been modified...
    Wednesday, January 18, 2012 2:38 PM
  • I'm thinking there has to be an easy way to do this with using the Exchange 2010 shell as I can't be the only one to ever come across this. If it can't be done via PowerShell without modifying the mail contact, is it supported to directly modify the msExchangeVersion attribute?

    Hi,
    I haven't got -Forceupgrade to work on mailcontacts either so I have also used the "method" of changing an attribute.

    Example:
    Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 Update
    Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 $null


    Martina Miskovic
    • Marked as answer by final_round Tuesday, April 10, 2012 3:14 PM
    Wednesday, January 18, 2012 9:55 PM
  • Thanks Martina. I'll utilize that as a last resort if necessary but you would think MS would bake this functionality into the product natively without having to change the object.
    Thursday, January 19, 2012 12:32 PM
  • Hi

    I think that is because the msExchHomeServerName for some users pointed to a no more existing servername.

    And update-recipient will update the attributes after the msExchHomeServerName attributes were updated.

    If you would like to ask MS to put into product. You can ask on development forum

    http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads

    Cheers

    Zi Feng

     

    Friday, January 20, 2012 2:52 AM
    Moderator
  • The msExchHomeServerName attribute is exclusive to mailbox-enabled objects and is not present on mail-enabled contacts so I'm not quite sure how that would/would play into the equation here. I posed this question in this forum to see if the functionality did exist and I was just missing something. I'm beginning to think that upgrading the object to be an Exchange 2010 mail contact will require modifying the object. Anyone have any other thoughts?

    Monday, January 23, 2012 3:03 PM
  • Hi,
    I haven't got -Forceupgrade to work on mailcontacts either so I have also used the "method" of changing an attribute.

    Example:
    Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 Update
    Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 $null


    Martina Miskovic
    Thank you very much, Martina! This was driving me nuts not being able to update the hundreds of contacts to Exchange version 2010. Your method did the trick nicely. Much appreciated.
    • Proposed as answer by Parthiv_Nayak Tuesday, April 10, 2012 12:18 PM
    • Unproposed as answer by Parthiv_Nayak Tuesday, April 10, 2012 12:23 PM
    Friday, February 17, 2012 3:26 AM
  • I got it to work by changing the Use Mapi rich text format, replace the ExchangeVersion as needed.

    Get-MailContact -ResultSize Unlimited | where {$_.ExchangeVersion -eq "0.0 (6.5.6500.0)"} | Set-MailContact -UseMapiRichTextFormat "Always" -ForceUpgrade -Confirm:$False

    Tuesday, April 10, 2012 12:22 PM
  • I do it that way since i don't like touching a property without reversing.

        [Object[]] $Contacts = Get-MailContact -Filter { (RecipientTypeDetails -ne 'MailForestContact') -and ((ExchangeVersion -eq $null) -or (ExchangeVersion -lt 44220983382016)) } -ResultSize:Unlimited
        if ( ($Contacts -is [array]) -and ($Contacts.Count -gt 0) )
        {
            if ( $PSCmdlet.ShouldProcess("On $($Contacts.Count) Mail Contact(s)") )
            {
                foreach ( $Contact in $Contacts )
                {
                    $Contact = $Contact | Get-MailContact -ReadFromDomainController
                    $Contact | Set-MailContact -UsePreferMessageFormat:(-not $Contact.UsePreferMessageFormat) -ForceUpgrade -DomainController:($Contact.OriginatingServer) -Confirm:$false
                    $Contact | Set-MailContact -UsePreferMessageFormat:($Contact.UsePreferMessageFormat) -DomainController:($Contact.OriginatingServer) -Confirm:$false
                }
            }
        }
    Of course this can eventually be optimized with more one-liners but that's not the purpose here :)

    Cheers,

    Benoit.


    Benoit Boudeville - Avanade France & Belux Microsoft Certified Master - Office Communications Server 2007/R2 http://unifiees.blogspot.com



    Friday, August 17, 2012 1:28 PM
  • Martina_Miskovic:

    Thanks - That worked great for me!

    I verified before and after that it upgraded by doing this:

      Get-MailContact -ResultSize unlimited | ft DisplayName,ExchangeVersion
      Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 Update
      Get-MailContact -resultsize Unlimited | Set-MailContact -CustomAttribute1 $null
      Get-MailContact -ResultSize unlimited | ft DisplayName,ExchangeVersion

    Russell

    Friday, October 19, 2012 5:13 PM