$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
10 Aug // php the_time('Y') ?>
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:
1 2 | # Add Exchange Snapins if ((Get-PSSnapin | where {$_.Name -match "Exchange.Management"}) -eq $null) { Add-PSSnapin Microsoft.Exchange.Management.* } |
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.
1 2 3 4 5 6 7 8 9 10 11 | # The keys, see http://social.technet.microsoft.com/wiki/contents/articles/configure-static-rpc-ports-on-an-exchange-2010-client-access-server.aspx $RPCKey = "SYSTEM\CurrentControlSet\Services\MSEXchangeRPC\ParametersSystem" $ABKey = "SYSTEM\CurrentControlSet\Services\MSEXchangeAB\Parameters" # Value Names $RPCValue = "TCP/IP Port" $ABValue = "RpcTcpPort" # The port numbers $RPCPort = 60200 $ABPort = "60201" # Address Book uses REG_SZ and not REG_DWORD! |
Then I use the Get-ClientAccessServer cmdlet to get all the CAS servers and set the values in a foreach loop:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | foreach ($CasServer in Get-ClientAccessServer) { # Open Remote Registry $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $CasServer) # Open Subkey with Write Access $regKey = $reg.OpenSubKey($RPCKey, $True) # If the key doesn't exist we will create it! if (!$regKey) { $reg.CreateSubKey($RPCKey) $regKey = $reg.OpenSubKey($RPCKey, $True) } # Write Value $regKey.SetValue($RPCValue, $RPCPort) # Dump Written Value (check) Write-Host $CasServer.Name $regKey.Name $RPCValue $regKey.GetValue($RPCValue) $regKey = $reg.OpenSubKey($ABKey, $True) if (!$regKey) { $reg.CreateSubKey($ABKey) $regKey = $reg.OpenSubKey($ABKey, $True) } $regKey.SetValue($ABValue, $ABPort) # Dump Written Value (check) Write-Host $CasServer.Name $regKey.Name $ABValue $regKey.GetValue($ABValue) } |
Leave a reply