Script for Configuring Exchange 2010 Internal and External URLs

[tweetmeme source=”stalehansen” only_single=false]In Exchange 2010 you need to set the Internal URLs for various services on the Client Access Server. Outlook 2007/2010 uses Autodiscover to connect to the Exchange server. If the Internal URLs are configured wrong you could get certificate errors when logging on to Outlook as well as errors when using free busy and oof services internally. Also when deploying Outlook Anywhere you need to configure the External URLs correct for the same services to work.

This script may come in handy in the following scenarios:

  • Initial configuration, avoid typos
  • Expansion in the infrastructure with load balanced CAS
  • Change in internal FQDN if you change certificate name
  • When you have a total disaster on site 1 and need to fail over to a second site with a passive DAG server that holds all server roles

Please keep in mind:

  • The Script is developed for Exchange 2003 coexistence and migration scenarios
  • The script must not be run in an Exchange 2007 coexistence and migration scenario
  • For InternalURL the script will look for a CASArray (It is recommended to create a CASArray in any scenario)
  • The script assumes there is only one ADsite

About the script:

  • First you will be presented with som choices on what to do
  • InternalURL will autoconfigure based on CASArray
  • ExternalURL will prompt for public FQDN and assume one external address
    • Will use same FQDN for OWA, ActiveSync, Autodiscover and so on
  • Will prompt for Exchange 2003 URL
  • All configuration will output the changes made

 

Update 27.05.2010:

  • Added support for Exchange 2007 and Exchange 2007/2010 coexistence scenarios.
  • The script will check for Exchange version before applying any settings.
  • When applying Exchange 2010 Internal URL the script will match the CAS servers to the correct CASarray in the correct ADsite

 

Update 28.05.2010

  • Added option for checking current configuration
  • Corrected some errors on the Exchange 2007 configuration and listing of URLs
  • Tested in Exchange 2007 only deployments and Exchange 2010 and 2007 coexistence deployments

 The Script can be viewed and downloaded here: https://msunified.net/exchange-downloads/script-internalexternalurls-ps1/

Configure Exchange 2010 InternalUrl PowerShell script

[tweetmeme source=”stalehansen” only_single=false]

UPDATE: This script has been updated and revamped 07.05.2010 and described in this post: https://msunified.net/2010/05/07/script-for-configuring-exchange-2010-internal-and-external-urls/

In Exchange 2010 you need to set the internal URL for various services on the Client Access Server. Outlook 2007 uses autodiscover internally to connect to the exchange server. If internal URL is configured wrong you could get certificate errors when logging on to Outlook as well as errors when using other services internally.

This script may come in handy in the following scenarios

  • Initial configuration
  • Expansion in the infrastructure with load balanced CAS
  • Change in internal FQDN if you change certificate name
  • Change from https to http
  • When you have a total disaster on site 1 and need to fail over to a second site with a passive DAG server that holds all server roles

 It is a very simple script, if you have some advice to make the script better I would be happy if you let me know. The script does the following:

  • The server path is specified with a prompt
  • The script is set up with “-identity *” if you have more than one instance you need to specify wich instance you want to configure
  • The url is generated using the variable and the default location of the services
  • After configuring the URL’s the scritp lists all changes so its easy to doublecheck the configuration
  • The UM role is excluded because it is not supported to be hosted on the same server as CAS

To run the script do the following:

  • Copy this into a txt file and rename it to a ps1 file
  • Open powershell and navigate to the location where the file is saved
  • Use tab in powershell to get the correct run syntax
  • Run it and type the correct FQDN like this when prompted: https://yourcasserver.domain.local
#InternalURL.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"
#get commands to  to doublecheck the config
get-AutodiscoverVirtualDirectory | ft identity,internalurl
get-ClientAccessServer | ft identity,AutodiscoverServiceInternalUri
get-webservicesvirtualdirectory | ft identity,internalurl
get-oabvirtualdirectory | ft identity,internalurl
get-owavirtualdirectory | ft identity,internalurl
get-ecpvirtualdirectory | ft identity,internalurl
get-ActiveSyncVirtualDirectory | ft identity,internalurl