.\CollectReplicationMetrics.ps1 –DagName OnsDAG1 -ReportPath C:\Scripts\Output -Duration "00:10:00" -Frequency "00:01:00" .\CollectOverMetrics.ps1 -DatabaseAvailabilityGroup OnsDAG1 -StartTime "06 October 2015 15:20:05" -EndTime "06 October 2015 15:28:05" -GenerateHTMLReport –ShowHTMLReport Get-Mailbox -Server fa1rvwmsxx464 -Monitoring | Disable-Mailbox Get-Mailbox -Server fa1rvwmsxx464 -ARBITRATION | Disable-Mailbox Get-Mailbox -Server fa1rvwmsxx464 -DiscoverySearchMailbox | Disable-Mailbox Get-Mailbox | Where ArchiveDatabase -eq "Mailbox Database 0712797833" Remove-MailboxDatabase -Identity "Mailbox Database 0712797833" Get-Mailbox | where {$_.ArchiveDatabase -eq "Mailbox Database 0712797833"} Get-Mailbox -Database "Mailbox Database 0712797833" | New-MoveRequest -TargetDatabase "Mailbox Database 1539870071" =======DAG MAintainance Using the Test-ReplicationHealth cmdlet will allow you to check all aspects of the replication and replay status, providing you with a complete overview of a Mailbox server in a DAG. This way, administrators can proactively monitor the continuous replication and the continuous replication pipeline, the availability of the Active Manager and the health and status of the underlying cluster service, quorum and network components. (Get-DatabaseAvailabilityGroup) | ForEach {$_.Servers | ForEach {Test-ReplicationHealth -Server $_}} CollectOverMetrics.ps1 Script This excellent script (found in the Exchange Scripts folder) reads event logs to gather information about database operations (such as database mounts, moves and failovers) over a specific period of time. For each of these operations it will record the following information: Identity of the database; The time the operation began and ended; Servers on which the database was mounted at the start and finish of the operation; Reason for the operation; If the operation was successful, including the error details if the operation failed. The script, which supports parameters to customize its behaviour, creates a .CSV file with all this information and can even create a nice HTML report: CollectOverMetrics.ps1 -DatabaseAvailabilityGroup DAG1 -StartTime "06/15/2012" -EndTime "06/16/2012" -GenerateHTMLReport –ShowHTMLReport 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 } } } ====The third command creates an alias, "installutil", for the path to the InstallUtil tool in .NET Framework. set-alias installutil $env:windir\Microsoft.NET\Framework64\v4.0.30319\installutil.exe ====uses the InstallUtil tool to register the snap-in. installutil C:\Windows\Microsoft.net\Framework64\V4.0.30319\installutil myDLL.dll installutil C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.PowerShell.Core.Activities\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.Powershell.Core.Activities.dll PS> $snapinPath = 'Microsoft.Exchange.Management.PowerShell.Admin.dll' PS> C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /i $snapinPath