Patching on Exchange Server 2013 DAG Mailbox Servers

The below Exchange 2013 powershell script will be very much helpful when you required to install Window Update or Exchange Cumulative update in Exchange 2013. This will help to move the active database to their respective passive and bring the Exchange 2013 Server under maintenance.  


The Second part of the script is used after the Exchange Server 2013 installation completes and server came up. Need to revert the changes that is performed initially. This script will help you out. Try to customize the server name and database based upon your Exchange Organization naming standard. 

Before Maintenance

Move-ActiveMailboxDatabase DB01 -ActivateOnServer MBX02 -MountDialOverride:None -confirm:$false
Move-ActiveMailboxDatabase DB03 -ActivateOnServer MBX02 -MountDialOverride:None -confirm:$false
Set-ServerComponentState –Identity MBX01–Component HubTransport –State Draining –Requester Maintenance -Verbose
Redirect-Message -Server MBX01-Target MBX02 -Confirm:$false -Verbose
Suspend-ClusterNode –Name MBX01-Verbose
Set-MailboxServer –Identity MBX01–DatabaseCopyActivationDisabledAndMoveNow $True -Verbose
Set-MailboxServer –Identity MBX01–DatabaseCopyAutoActivationPolicy Blocked -Verbose
Set-ServerComponentState –Identity MBX01–Component ServerWideOffline –State InActive –Requester Maintenance -Verbose

After Maintenance

Set-ServerComponentState –Identity MBX01–Component ServerWideOffline –State Active –Requester Maintenance -Verbose
Resume-ClusterNode –Name MBX01-Verbose
Set-MailboxServer –Identity MBX01–DatabaseCopyAutoActivationPolicy Unrestricted -Verbose
Set-MailboxServer –Identity MBX01–DatabaseCopyActivationDisabledAndMoveNow $False -Verbose
Set-ServerComponentState –Identity MBX01–Component HubTransport –State Active –Requester Maintenance -Verbose
Move-ActiveMailboxDatabase DB01 -ActivateOnServer MBX01 -MountDialOverride:None -confirm:$false
Move-ActiveMailboxDatabase DB03 -ActivateOnServer MBX01 -MountDialOverride:None -confirm:$false


About Raji Subramanian

Nothing great to say about me...Just want to share my knowledge for others that will be useful at any moment of time when they stuck in critical issue....
This entry was posted in Exchange Powershell Scripts, Script, Uncategorized and tagged , . Bookmark the permalink.

2 Responses to Patching on Exchange Server 2013 DAG Mailbox Servers

  1. Mike says:


    In regard to your “Move-ActiveMailboxDatabase” commands…

    Why not do a FULL server switchover as supposed to moving databases one by one? That comes handy when you have multiple databases which is usually the case. Just run the following:

    Move-ActiveMailboxDatabase -Server MBX01 -ActivateOnServer MBX02

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s