Better Together
As most of Hosted Messaging and Collaboration (HMC) companies start planning to migrate to Exchange 2010 SP2 hosted environment due to the change in strategy that was announced about the future of /hosting mode here, so most HMC customer have to move directly to Exchange 2010 SP2 in hosted mode as discussed here, and one of the activities come up to migrate from HMC to Exchange 2010 SP2 is Downsizing activity in the running HMC environment to utilize part of hardware to be reused in the new Exchange 2010 SP2 environment, and although it looks like a simple activity for some IT people but there are a lot of challenges that can be in some cases for some specific HMC components show stopper to continue the downsizing activity, in this post series I will share all my experience with HMC downsizing activity and explain how I deal with different challenges in this activity, in Part1 I covered the first step of HMC downsizing activity to select server roles that will be decommissioned, then covered most of preparations tasks in each of the selected roles, and in Part2 I went through the most critical step of preparing Mailboxes for decommissioning that include the bulk mailbox move script that move mailboxes by calling MPS, one of the important resource while working in this activity is Microsoft Provisioning System SDK that can be downloaded from here.
In this post I will finalize this post series by finalizing 2nd Step of preparations and both 3rd Step for decommissioning activity itself and 4th Step which is post decommissioning activity.
So let me start with final preparations steps as follow:
3rd Step: Now the environment should be ready for 3rd step which is the decommissioning or uninstall the selected server roles as listed in 1st step and it is recommended to do one more verification step before doing uninstall which is shutdown the target server role for certain amount of time and validate the the whole HMC solution still functional and provisioning still working without problems, then to uninstall role by role and give time between each one for testing and verify HMC environment functionality.
4th Step: which is the post decommissioning activities, and in this step you should use all available tools to verify the HMC functionality and solve any discovered issues (you need to confirm that there is an active Microsoft Support for the HMC environment that can be used in case you face any issue while decommissioning), as sample of these tools you can use the following:
Hope that this post series can reducing the risk of downsizing activity and make it easier for consultant who will do the activity.
As most of Hosted Messaging and Collaboration (HMC) companies start planning to migrate to Exchange 2010 SP2 hosted environment due to the change in strategy that was announced about the future of /hosting mode here, so most HMC customer have to move directly to Exchange 2010 SP2 in hosted mode as discussed here, and one of the activities come up to migrate from HMC to Exchange 2010 SP2 is Downsizing activity in the running HMC environment to utilize part of hardware to be reused in the new Exchange 2010 SP2 environment, and although it looks like a simple activity for some IT people but there are a lot of challenges that can be in some cases for some specific HMC components show stopper to continue the down activity, one of the important resource while working in this activity is Microsoft Provisioning System SDK that can be downloaded from here.
In this post series I will share all my experience with HMC downsizing activity and explain how I deal with different challenges in this activity, in Part1 I covered the first step of HMC downsizing activity to select server roles that will be decommissioned, then covered most of preparations tasks in each of the selected roles.
In this post I will cover the preparations specific for Mailbox Role which is the most critical role of downsizing activity, and different preparations steps for Exchange MBX role can be divided as follows:
Mail Server Mailstore Organizations before Mailbox Move After Mailbox Move MBX01 MBX01-DB01 Org1.com Org2.com Org3.Net … … MBX01-DB02 … … MBX02 MBX02-DB01 … … MBX02-DB02 … … … … … …
Mail Server
Mailstore
Organizations before Mailbox Move
After Mailbox Move
MBX01
MBX01-DB01
Org1.com Org2.com Org3.Net …
…
MBX01-DB02
MBX02
MBX02-DB01
MBX02-DB02
PrimarySMTPAddress,TargetDB Maged@Org1.net,MBXV01\MBXV01SG01\MBXV01SG01DB01 Kip@Org2.com,MBXV01\MBXV01SG01\MBXV01SG01DB01 And the used script is below:
PrimarySMTPAddress,TargetDB Maged@Org1.net,MBXV01\MBXV01SG01\MBXV01SG01DB01 Kip@Org2.com,MBXV01\MBXV01SG01\MBXV01SG01DB01
And the used script is below:
# 1. Use the Exchange Management Shell to get the source server name with Get-ExchangeServer | Select Name # 2. Use the Exchange Management Shell to populate the input CSV file with Get-MailboxDatabase | where {$_.ServerName.Contains("sourceservername") -eq "true"} | Get-Mailbox | Select PrimarySMTPAddress,Database | Export-Csv C:\Temp\MbxsToBeMoved.csv –NoTypeInformation # 3. Change ‘Database’ field header to ‘TargetDB’ # 4. Modify database/targetdb field entries as required in the CSV # 5. Change preferredDomainController in mailbox move script # 6. Run mailbox move script: # CSV Example: # PrimarySMTPAddress,TargetDB # bloggsj,mytargetservername $path = "C:\MailboxMove\MbxsToBeMoved.csv"; Write-Host; Write-Host "*******************"; Write-Host "Move Mailbox Script" -Foregroundcolor Blue -Backgroundcolor White; Write-Host "*******************"; Write-Host; Write-Host "A CSV is required (i.e. $path)" $Ver1 = Read-Host "CONTINUE script execution? [Y] to continue or [ANY OTHER KEY] to exit" if ($Ver1 -ne "Y") {exit; } Write-Host; Write-Host "Valid entries in CSV:" -Foregroundcolor Blue -Backgroundcolor White; Write-Host; Write-Host "PrimarySMTPAddress,TargetDB"; Import-csv -path $path | foreach ` { $TDBs = Get-MailboxDatabase $_.TargetDB -ErrorVariable MyError -ErrorAction SilentlyContinue; $A = $_.PrimarySMTPAddress Write-Host "$A,$TDBS"; } If ($MyError -ne $null)` { Write-Host; Write-Host "*******"; Write-Host "Error" -Foregroundcolor Red -Backgroundcolor White; Write-Host "*******"; Write-Host "Invalid TargetDB in CSV. Script terminating..." -Foregroundcolor Blue -Backgroundcolor White; Write-Host "Error Description:" -Foregroundcolor Blue -Backgroundcolor White; $MyError; Write-Host; exit; } $Ver2 = Read-Host "CONTINUE moving ALL mailboxes in CSV? [Y] to continue or [ANY OTHER KEY] to exit" if ($Ver2 -ne "Y") {exit; } Function SendMPSRequest([string]$xmlRequestStr) { $oMpf = new-object -comobject "Provisioning.ProvEngineClient" $xmlResponseStr = $oMPF.SubmitTrustedRequest($xmlRequest.get_InnerXml()); $xmlResponse = new-object "System.Xml.XmlDocument"; $xmlResponse.LoadXml($xmlResponseStr); $xmlResponse; } [string]$xmlRequestStr = @" <?xml version="1.0" encoding="utf-8"?> <request> <data> <preferredDomainController>ad01.HMC.Local</preferredDomainController> <user>CSVPopulated</user> <targetDatabase>CSVPopulated</targetDatabase> </data> <procedure> <execute namespace="Hosted Email 2007" procedure="MoveMailbox" impersonate="1"> <before source="data" destination="executeData" mode="merge" /> <after source="executeData" destination="data" mode="merge" /> </execute> </procedure> </request> "@ [string]$excXmlStr = @" <?xml version="1.0" encoding="utf-8"?> "@ Write-Host Write-Host "Starting procedure..." -Foregroundcolor Blue -Backgroundcolor White; Write-Host $CSV = Import-csv -path $path Foreach ($line in $CSV)` { $mailbox = Get-Mailbox $line.PrimarySMTPAddress | Select PrimarySMTPAddress, DistinguishedName; Write-Host $line.PrimarySMTPAddress Write-Host $mailbox $userName = $mailbox.SameAccountName; $userDN = $mailbox.DistinguishedName; $TDB = $line.TargetDB Write-Host "Moving $userName to $TDB..." -ForegroundColor White Write-Host $xmlRequest = new-object "System.Xml.XmlDocument"; $xmlRequest.LoadXml($xmlRequestStr); $xmlRequest.request.data.user = "LDAP://" + $userDN; Write-Host $userDN; $xmlRequest.request.data.targetDatabase = $TDB; $xmlResponse = $null; $xmlResponse = SendMPSRequest($xmlRequestStr.ToString()); if ($xmlResponse.Response.Data.User -ne $null)` { $MPSUser = New-Object System.Object; $MPSUser | Add-Member -Type NoteProperty -Name "DistinguishedName" -Value $userDN; $MPSUser | Add-Member -Type NoteProperty -Name "User" -Value $xmlResponse.Response.Data.user; $MPSUser | Add-Member -Type NoteProperty -Name "TargetDB" -Value $xmlResponse.Response.Data.targetDatabase; $MPSUser | FL; } } Write-Host; Write-Host "********************************************************************************************************************************************************************************************"; Write-Host "Script execution complete. In pre-HMC4.0 Hosted Exchange Update Rollup 5 environments, please remember to run the Managed Email 2007::RepairExchangeObject procedure on all mailboxes moved." -Foregroundcolor Blue -Backgroundcolor White; Write-Host "********************************************************************************************************************************************************************************************"; Write-Host;
# 1. Use the Exchange Management Shell to get the source server name with Get-ExchangeServer | Select Name # 2. Use the Exchange Management Shell to populate the input CSV file with Get-MailboxDatabase | where {$_.ServerName.Contains("sourceservername") -eq "true"} | Get-Mailbox | Select PrimarySMTPAddress,Database | Export-Csv C:\Temp\MbxsToBeMoved.csv –NoTypeInformation # 3. Change ‘Database’ field header to ‘TargetDB’ # 4. Modify database/targetdb field entries as required in the CSV # 5. Change preferredDomainController in mailbox move script # 6. Run mailbox move script: # CSV Example: # PrimarySMTPAddress,TargetDB # bloggsj,mytargetservername $path = "C:\MailboxMove\MbxsToBeMoved.csv"; Write-Host; Write-Host "*******************"; Write-Host "Move Mailbox Script" -Foregroundcolor Blue -Backgroundcolor White; Write-Host "*******************"; Write-Host; Write-Host "A CSV is required (i.e. $path)" $Ver1 = Read-Host "CONTINUE script execution? [Y] to continue or [ANY OTHER KEY] to exit" if ($Ver1 -ne "Y") {exit; } Write-Host; Write-Host "Valid entries in CSV:" -Foregroundcolor Blue -Backgroundcolor White; Write-Host; Write-Host "PrimarySMTPAddress,TargetDB"; Import-csv -path $path | foreach ` { $TDBs = Get-MailboxDatabase $_.TargetDB -ErrorVariable MyError -ErrorAction SilentlyContinue; $A = $_.PrimarySMTPAddress Write-Host "$A,$TDBS"; } If ($MyError -ne $null)` { Write-Host; Write-Host "*******"; Write-Host "Error" -Foregroundcolor Red -Backgroundcolor White; Write-Host "*******"; Write-Host "Invalid TargetDB in CSV. Script terminating..." -Foregroundcolor Blue -Backgroundcolor White; Write-Host "Error Description:" -Foregroundcolor Blue -Backgroundcolor White; $MyError; Write-Host; exit; } $Ver2 = Read-Host "CONTINUE moving ALL mailboxes in CSV? [Y] to continue or [ANY OTHER KEY] to exit" if ($Ver2 -ne "Y") {exit; } Function SendMPSRequest([string]$xmlRequestStr) { $oMpf = new-object -comobject "Provisioning.ProvEngineClient" $xmlResponseStr = $oMPF.SubmitTrustedRequest($xmlRequest.get_InnerXml()); $xmlResponse = new-object "System.Xml.XmlDocument"; $xmlResponse.LoadXml($xmlResponseStr); $xmlResponse; } [string]$xmlRequestStr = @" <?xml version="1.0" encoding="utf-8"?> <request> <data> <preferredDomainController>ad01.HMC.Local</preferredDomainController> <user>CSVPopulated</user> <targetDatabase>CSVPopulated</targetDatabase> </data> <procedure> <execute namespace="Hosted Email 2007" procedure="MoveMailbox" impersonate="1"> <before source="data" destination="executeData" mode="merge" /> <after source="executeData" destination="data" mode="merge" /> </execute> </procedure> </request> "@ [string]$excXmlStr = @" <?xml version="1.0" encoding="utf-8"?> "@ Write-Host Write-Host "Starting procedure..." -Foregroundcolor Blue -Backgroundcolor White; Write-Host $CSV = Import-csv -path $path Foreach ($line in $CSV)` { $mailbox = Get-Mailbox $line.PrimarySMTPAddress | Select PrimarySMTPAddress, DistinguishedName; Write-Host $line.PrimarySMTPAddress Write-Host $mailbox $userName = $mailbox.SameAccountName; $userDN = $mailbox.DistinguishedName; $TDB = $line.TargetDB Write-Host "Moving $userName to $TDB..." -ForegroundColor White Write-Host $xmlRequest = new-object "System.Xml.XmlDocument"; $xmlRequest.LoadXml($xmlRequestStr); $xmlRequest.request.data.user = "LDAP://" + $userDN;
Write-Host $userDN;
$xmlRequest.request.data.targetDatabase = $TDB; $xmlResponse = $null; $xmlResponse = SendMPSRequest($xmlRequestStr.ToString()); if ($xmlResponse.Response.Data.User -ne $null)` { $MPSUser = New-Object System.Object; $MPSUser | Add-Member -Type NoteProperty -Name "DistinguishedName" -Value $userDN; $MPSUser | Add-Member -Type NoteProperty -Name "User" -Value $xmlResponse.Response.Data.user; $MPSUser | Add-Member -Type NoteProperty -Name "TargetDB" -Value $xmlResponse.Response.Data.targetDatabase; $MPSUser | FL; } } Write-Host; Write-Host "********************************************************************************************************************************************************************************************"; Write-Host "Script execution complete. In pre-HMC4.0 Hosted Exchange Update Rollup 5 environments, please remember to run the Managed Email 2007::RepairExchangeObject procedure on all mailboxes moved." -Foregroundcolor Blue -Backgroundcolor White; Write-Host "********************************************************************************************************************************************************************************************"; Write-Host;