Tech for Techs

Servers => Microsoft Exchange => Topic started by: Adventech on August 11, 2015, 01:20:54 PM

Title: Change Exchange Virtual Directory Internal and External URL's
Post by: Adventech on August 11, 2015, 01:20:54 PM
PROBLEM:
Change Exchange Virtual Directory Internal and External URL's.

SOLUTION:

Create PowerShell Script to change the IIS sites.

#URL.ps1
$urlpath = Read-Host "Type internal Client Access FQDN starting with http:// or https://"
Set-AutodiscoverVirtualDirectory -Identity * –internalurl "$urlpath/autodiscover/autodiscover.xml"
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"
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"
#get commands to  to doublecheck the config
get-AutodiscoverVirtualDirectory | fl identity,internalurl, externalurl
get-ClientAccessServer | fl identity,AutodiscoverServiceInternalUri
get-webservicesvirtualdirectory | fl identity,internalurl,externalurl
get-oabvirtualdirectory | fl identity,internalurl,externalurl
get-owavirtualdirectory | fl identity,internalurl,externalurl
get-ecpvirtualdirectory | fl identity,internalurl,externalurl
get-ActiveSyncVirtualDirectory | fl identity,internalurl,externalurl


Note: You will need to make sure you have your external site added to your DNS to point to the local exchange IP.