SNAGHTML1ca684c

I am currently working on an Exchange migration from 2003 to 2010. For the implementation of a load balancing solution for the CAS/HUB servers I needed to set Static RPC Ports for the RPC Client Access Service and the Exchange Address Book Service.

The procedure of changing these ports is described on the Technet Wiki: Configure Static RPC Ports on an Exchange 2010 Client Access Server

Since I am lazy I decided to do this with a PowerShell script that would automatically do this for all CAS/HUB servers in my 2010 environment.

First we need to load the Exchange Management SnapIns:


Then I have defined the registry keys and port numbers (Microsoft recommends any port between 59531 and 60554, I am using 60200 and 60201):

Update: The Address Book Service uses a REG_SZ key and not a DWORD therefore I changed $ABPort to a string value.


Then I use the Get-ClientAccessServer cmdlet to get all the CAS servers and set the values in a foreach loop: