Powershell Database Migrations with Exchange 2010 DAG

I recently had to do some hardware maintenance on one of the DAG members in our Exchange 2010 setup. Before bringing the server down, I had to roll-over all the active databases to another member of the DAG. After right clicking a couple databases, it became old very quickly so I set out to the command line. Below are a few examples of commands that I used.

To move all active databases from the server, LA-MB1, to another member of the DAG that has a healthy copy:

[PS] C:Windowssystem32>Move-ActiveMailboxDatabase -Server LA-MB1

 

That cleared all the databases off the server so I could shut it down for my upgrade. Once the upgrade is complete, I needed to move the correct databases back to their original server. With our naming convention for the databases, it was a simple match regular expression to grab the databases I wanted, then piped into the move command.

Move all databases that start with “AZ” to the server, LA-MB1:

[PS] C:Windowssystem32>Get-MailboxDatabase | where {$_.Identity -match "^AZ"} | Move-ActiveMailboxDatabase -ActivateOnServer LA-MB1 -MountDialOverride:None -Confirm:$false
 
Identity        ActiveServerAtS ActiveServerAtE Status     NumberOfLogsLost   RecoveryPoint MountStatus MountStatus
                tart            nd                                            Objective     AtMoveStart AtMoveEnd
--------        --------------- --------------- ------     ----------------   ------------- ----------- -----------
AZ-Admin        dc-mb1          la-mb1          Succeeded  0                  3/23/2012 ... Mounted     Mounted
AZ-VIP          dc-mb1          la-mb1          Succeeded  0                  3/23/2012 ... Mounted     Mounted
AZ-Tech         dc-mb1          la-mb1          Succeeded  0                  3/23/2012 ... Mounted     Mounted

 

Leave a Reply

Your email address will not be published. Required fields are marked *