Managing Exchange 2010 External/Internal URL’s via PowerShell

Exchange 2010 has the concept of internal and external URL’s for various virtual directories for the Client Access Server.

It is important to specify the correct values as as the SAN certificates will need to match otherwise you will encounter use issues.

Below commmands in powershell will list all the information related to virtual directory and their respective URLS.

get-AutodiscoverVirtualDirectory
get-ClientAccessServer
get-webservicesvirtualdirectory
get-oabvirtualdirectory
get-owavirtualdirectory
get-ecpvirtualdirectory
get-ActiveSyncVirtualDirectory

Add “| Fl” to the Cmdlets to see all the properties

To set the URL’s for all directories at once, run the following powershell commands (save it as a .ps1 extension and run it in EMS)

For internal URLs:

$urlpath = Read-Host “Type internal Client Access FQDN starting with http:// or https://”

Set-ClientAccessServer –Identity * –AutodiscoverServiceInternalUri “$urlpath/autodiscover/autodiscover.xml”
Set-webservicesvirtualdirectory –Identity * –internalurl “$urlpath/ews/exchange.asmx”
Set-oabvirtualdirectory –Identity * –internalurl “$urlpath/oab”
Set-owavirtualdirectory –Identity * –internalurl “$urlpath/owa”
Set-ecpvirtualdirectory –Identity * –internalurl “$urlpath/ecp”
Set-ActiveSyncVirtualDirectory -Identity * -InternalUrl “$urlpath/Microsoft-Server-ActiveSync”

External URLs:

Set-ClientAccessServer –Identity * –AutodiscoverServiceExternalUri “$urlpath/autodiscover/autodiscover.xml”
Set-webservicesvirtualdirectory –Identity * -ExternalUrl “$urlpath/ews/exchange.asmx”
Set-oabvirtualdirectory –Identity * –ExternalUrl “$urlpath/oab”
Set-owavirtualdirectory –Identity * –ExternalUrl “$urlpath/owa”
Set-ecpvirtualdirectory –Identity * –ExternalUrl “$urlpath/ecp”
Set-ActiveSyncVirtualDirectory -Identity * -ExternalUrl “$urlpath/Microsoft-Server-ActiveSync”