#Exchange 2010 and CAS Arrays

#Exchange2010 #Powershell

So in my lab I have been playing with CAS Arrays before they hit production.  I have also spoken to number of people about them and I think Exchange 2010 SP2 need to address a tiny issue that would make CAS Arrays great.


… When a Client Access server array is defined in an Active Directory site, it serves as a single contact point for all client connections within that Active Directory site. A Client Access server array can include one or many Client Access servers.

Each Active Directory site can have a single Client Access server array. A Client Access server array doesn’t provide load balancing. A separate load balancing solution is still needed.

So this is cool, you set up CAS Arrays per AD Site, and then you need to set the RPCClientAccessServer value for mailbox databases.

BUT, if you have say a 4 node DAG that is split say over 2 AD sites, things get interesting.  Why? well if a database fails over to another AD site, the RPCClientAccessServer  doesn’t get automatically updated.  Now this isn’t an issue as the CAS servers will proxy, but its not an ideal solution, you really want your users to go to the CAS Array in the AD site the mailbox database is in.  So what would be nice is for Exchange 2010 SP2 to automatically update the RPCClientAccessServer when a active database copy is moved.

So rant off, i knocked this up yesterday to address this.  Check it out and let me know what you think:

$CASArray  = @{“–” = “—“}
$MBXArray  = @{“–” = “—“}
Get-ClientAccessArray | Foreach{$s=$_.Site;$f=$_.fqdn;$CASArray += @{“$s” = “$f”} }
Get-ExchangeServer | Foreach{$s=$_.Site;$n=$_.Name;$MBXArray += @{“$n” = “$s”} }
$Databases = Get-MailboxDatabase
#Look each mailbox server and assign the appropriate CASArray
#based on AD site
ForEach($Database in $Databases){
$db           = $Database.Name
$inServerName = $Database.ServerName
Write-Host “Mailbox Database: ” $db
Write-Host $inServerName “:” $Database.RpcClientAccessServer -NoNewLine
$ADSite = $MBXArray[$inServerName]
$CA = $CASArray[$ADSite]
Write-Host ” – ” $ADSite “:” $CA -NoNewLine
If($Database.RpcClientAccessServer -eq $CA){Write-Host ” OK`n” -Foregroundcolor GREEN
   Write-Host ” ERR`n” -Foregroundcolor RED
   Set-MailboxDatabase $db -RpcClientAccessServer $CA