Thursday, January 26, 2012

How to Remove Failed Server from DAG in Exchange Server 2010

When an Exchange Server 2010 Mailbox server that is a member of a Database Availability Group has failed, part of the recovery process is to remove it from DAG membership.

In some scenarios this process may result in an error "A quorum of cluster nodes was not present to form a cluster". The full error text is below.

[PS] C:\>Remove-DatabaseAvailabilityGroupServer -Identity DAG -MailboxServer EX2

Confirm
Are you sure you want to perform this action?
Removing Mailbox server "EX2" from database availability group "dag".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
WARNING: The operation wasn't successful because an error was encountered. You may find more details in log file
"C:\ExchangeSetupLogs\DagTasks\dagtask_2010-11-25_03-48-09.814_remove-databaseavailabiltygroupserver.log".
There was a problem changing the quorum model for database availability group dag. Error: An Active Manager operation f
ailed. Error: An error occurred while attempting a cluster operation. Error: Cluster API '"SetClusterQuorumResource() f
ailed with 0x1725. Error: A quorum of cluster nodes was not present to form a cluster"' failed..
+ CategoryInfo : InvalidArgument: (:) [Remove-DatabaseAvailabilityGroupServer], DagTaskProblemChangingQuo
rumException
+ FullyQualifiedErrorId : 80D96894,Microsoft.Exchange.Management.SystemConfigurationTasks.RemoveDatabaseAvailabili
tyGroupServer

To resolve this issue use the -ConfigurationOnly switch instead to remove the failed Mailbox server from the Exchange 2010 DAG. In this example server EX2 is being removed.

[PS] C:\>Remove-DatabaseAvailabilityGroupServer -Identity DAG -MailboxServer EX2 -ConfigurationOnly

Next, evict the failed node from the Windows Failover Cluster.

Note: you need to import the Failover Cluster module into your Exchange Management Shell session to perform this task.

[PS] C:\>Import-Module FailoverClusters
[PS] C:\>Get-ClusterNode EX2 | Remove-ClusterNode -Force

The failed server has now been removed from the Exchange 2010 DAG and the Windows Failover Cluster.

Friday, January 20, 2012

Get-MailboxDatabase Size list

Exchange 2007

There are a couple methods you can use to get this information in Exchange 2007. Here is a great example posted by Gary Siepser; it's a one-liner that retrieves the database size using WMI, allowing you to run it against clustered mailbox servers:
Get-MailboxDatabase | foreach-object {add-member -inputobject $_ -membertype noteproperty -name mailboxdbsizeinGB -value ([math]::Round(([int64](get-wmiobject cim_datafile -computername $_.server -filter ('name=''' + $_.edbfilepath.pathname.replace("\","\\") + '''')).filesize / 1GB),2)) -passthru} | Sort-Object mailboxdbsizeinGB -Descending | format-table identity,mailboxdbsizeinGB

Exchange 2010

Fortunately, the Get-MailboxDatabase cmdlet in Exchange 2010 provides this information for us out of the box. All you need to do is use the Status parameter and you can access the information using the DatabaseSize property. Here is an example:
Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize