Monday, September 28, 2015

Configuring Client Access Web Directory URL Settings on Multiple Access Servers

Hi folks,

Just wanted to share with you a quick and easy way to configure virtual directories URL settings for each of client access protocols in Exchange 2013 or 2016.

This is usually one of the first steps of configuring CAS layers on Exchange servers. And because there's a lot of typing there's always a risk to make a mistake when typing the URL of each virtual directory. To avoid an error PowerShell magic scripting comes to our help.

As the first step we need to properly configure virtual directories as described here. After this we need to check that all the URLs are configured without a mistake. If this is a true then we are ready to put together a script which can be easily applied for the rest of CAS virtual directories in your environment.

You can achieve it by creating a variable for each of the virtual directories and then use InternalUrl and ExternalUrl attribute values to configure the InternalURL and ExternalURL of the virtual directories on the remaining servers. You can this way configure from 1 to the unlimited number of the servers.

$OWA = Get-OwaVirtualDirectory -Server SERVER1
Set-OwaVirtualDirectory -Identity "SERVER2\OWA (Default Web Site)" -InternalUrl $OWA.InternalUrl -ExternalUrl $OWA.ExternalUrl

$ECP = Get-EcpVirtualDirectory -Identity "SERVER1\ECP (Default Web Site)"
Set-EcpVirtualDirectory -Identity "SERVER2\ECP (Default Web Site)" -InternalURL $EC.InternalUrl -ExternalUrl $ECP.ExternalUrl

$OAB = Get-OABVirtualDirectory -Identity "SERVER1\OAB (Default Web Site)"
Set-OABVirtualDirectory -Identity "SERVER2\OAB (Default Web Site)" -InternalUrl $OAB.InternalUrl -ExternalUrl $OAB.ExternalUrl –RequireSSL:$true

$EWS = Get-WebServicesVirtualDirectory -Identity "SERVER1\EWS (Default Web Site)"
Set-WebServicesVirtualDirectory -Identity "SERVER2\EWS (Default Web Site)" -InternalUrl $EWS.InternalUrl -ExternalUrl $EWS.ExternalUrl

$OA=Get-OutlookAnywhere -Identity "SERVER1\Rpc (Default Web Site)"

Set-OutlookAnywhere -Identity "<Server Name>\Rpc (Default Web Site)" -InternalHostname $OA.InternalHostname  -ExternalHostname $OA.ExternalHostname

I hope that it helps you as it helped me.