PS Script to Upgrade Mail Contacts to 2010
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?
January 18th, 2012 1:34pm
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
Free Windows Admin Tool Kit Click here and download it now
January 18th, 2012 1:44pm
I have tried that and you are correct - you get the warning stating no settings have been modified...
January 18th, 2012 2:38pm
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.
Free Windows Admin Tool Kit Click here and download it now
January 19th, 2012 12:32pm
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
January 20th, 2012 2:52am
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?
Free Windows Admin Tool Kit Click here and download it now
January 23rd, 2012 3:03pm
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
August 17th, 2012 1:34pm