If you are doing maintenance on a server and want to suspend all database copies on that server (assuming none are mounted) it is very simple and all you have to do is run:
Get-MailboxDatabaseCopyStatus -Server | Suspend-MailboxDatabaseCopy -Confirm:$False
If you want to suspend all copies of a particular database (except the one that is mounted of course) across all servers you can simply run:
Get-MailboxDatabaseCopyStatus | Suspend-MailboxDatabaseCopy
And ignore the “The suspend operation can’t proceed because database ” on Exchange Mailbox server ” is the active mailbox database copy.” error message.
But what if you just want to suspend the 4th copy of all your databases across all your servers? In this case, we will have to use the following script:
$dbs = Get-MailboxDatabase
ForEach ($db in $dbs) {
ForEach ($dbCopy in $db.DatabaseCopies) {
If ($dbCopy.ActivationPreference -eq 4) {
Suspend-MailboxDatabaseCopy $dbCopy.Identity -Confirm:$False
}
}
}