Wednesday, May 21, 2014

Activate Earlier DBs

Last Friday night we patched each of our Exchange 2010 DAGs with the latest Windows OS patches. As a practice, I start with node 1, and work down the list to node 6.


  1. Run $ExScripts\StartDagMaintenance.ps1 to put DAG in maintenance mode and move active DBs off to passive nodes. 
  2. Run batch file to disable ForeFront integration on this 2010 server. 
  3. Start Windows Update process (do not let WU reboot server!!)
  4. Reverse step 2, re-integrate FF.
  5. Reverse step 1, run $ExScripts\StopDagMaintenance.ps1 script; reboot server
Now, unfortunately, the server no longer has any of it's active dbs still running on it. Sure, I'll run the rebalance db script when the entire process completes, but at 2am, I don't always like waiting to the very end. Plus the StartDagMaintenance script can take quite awhile when hitting server 4,5,6 in the process. 

So, Friday, I wrote up this little script to 'activate earlier dbs' on my current server. 

$s = $env:Computername;Get-MailboxDatabase -Server $s | ?{$_.activationpreference[0].key.name -eq $s -and $_.server.tostring() -lt $s} | Move-ActiveMailboxDatabase -ActivateOnServer $s


So, if you are on server 3 of the DAG and you run this script it will check to see if any dbs are currently active on server 1 and 2. If so, it will activate those copies. 

Assumption: Your dag nodes are alphabetically in order. For example:
  • DAG101
  • DAG102
  • DAG103
  • DAG104
  • DAG105
  • DAG106

No comments:

Post a Comment