ConfigureExchangeURLs.ps1 is a PowerShell script to make it quick and easy to configure the Client Access namespaces on your Exchange servers. The script is designed to apply the same namespace to all Client Access services on the server. You can specify different internal and external URLs. If you have a more complex namespace configuration to apply (for example separate namespaces for each service) then this script does not cater to your scenario, however you can probably adapt it your particular needs.

The script has some mandatory parameters:

  • -Server – The name(s) of the server(s) you are configuring.
  • -InternalURL – The internal namespace you are using.
  • -ExternalURL – The external namespace you are using.

There are some optional parameters as well, if you need them for your configuration. If you don’t use the optional parameters they default to the most common settings in my experience.

  • -AutodiscoverSCP – Used to specify a different Autodiscover namespace if required.
  • -InternalSSL – Specifies the internal SSL requirement for Outlook Anywhere. Defaults to True (SSL required).
  • -ExternalSSL – Specifies the external SSL requirement for Outlook Anywhere. Defaults to True (SSL required).

You can configure one or multiple servers at the same time. For example, to configure a single server:

.ConfigureExchangeURLs.ps1 -Server sydex1 -InternalURL mail.exchangeserverpro.net -ExternalURL mail.exchangeserverpro.net

To configure multiple servers:

.ConfigureExchangeURLs.ps1 -Server sydex1,sydex2 -InternalURL mail.exchangeserverpro.net -ExternalURL mail.exchangeserverpro.net

To use a different Autodiscover namespace:

.ConfigureExchangeURLs.ps1 -Server sydex1,sydex2 -InternalURL mail.exchangeserverpro.net -ExternalURL mail.exchangeserverpro.net -AutodiscoverSCP autodiscover.exchangeserverpro.net

Download ConfigureExchangeURLs.ps1 from the TechNet Gallery or Github. Questions and feedback are welcome in the comments below.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Dmytro Yunh

    Hi Paul, our exchange server version is 2010 Version 14.3 (Build 123.4).
    My problem is:
    We have ssl certificate for external url, external clients, owa, ecp works perfectly, but local Outlook clients get certificate name mismatch, when connecting to internal url.
    I want to change internal url to match the external, to make local Outlook clients connect to url that matches CN in certificate.

    During Script execution there was 2 errors:
    1. Configuring Outlook Anywhere URLs
    A positional parameter cannot be found that accepts argument ‘asn.domain.com.ua’.
    + CategoryInfo : InvalidArgument: (:) [Set-OutlookAnywhere], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Set-OutlookAnywhere
    2. Configuring MAPI/HTTP URLs
    The term ‘Get-MapiVirtualDirectory’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:25
    + Get-MapiVirtualDirectory <<<< -Server $Server
    + CategoryInfo : ObjectNotFound: (Get-MapiVirtualDirectory:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    And finally our Outlook clients get certificate name mismatch, as previous.
    I'd be very grateful if you can help me.
    Thank You

    1. Luka

      Hi,

      have you managed to sort this issue?

  2. Lee

    Can confirm this works on Exchange 2019. Paul I need your powershell karate skills!

  3. CA

    Hi Paul,

    i have 2 exchange 2019 servers, after running the script i am able to access the first server’s ECP by using https:///ecp and it works however, when i try the same on the second server it redirects me to https://mail..co.uk. is this normal behaviour ?

  4. Andrey

    Hi Paul. I stuck with autodiscover.xml on my Exchange 2016. The file is missing, therefore I am unable to configure Outlook clients. Is there a way to generate this file?

  5. Pete Long

    Once again this bailed me out today, Thanks Paul, your contributions to the online Exchange community are much appreciated!

    Pete Long

  6. John

    Has anyone used the script on 2019 Exchange?

    1. Evandro Boa Semedo

      Yeah, Work Perfectly.

  7. Kanga

    Hi Paul, let say I have 2 ISPs . I configure mail1.mydomaine.org and mail2.mydomaine.com with each of the ISP IP address on the external domain. Then in the local domain, configure correctly the DNS entries for CAS failover and loadbalancing.
    What should I configure at the virtual directory level or at the send and receive connectors to ensure that if one of my ISP is down, the mails are still going and coming?

  8. Jide

    Hi Paul, I just tried to use this script to get my exchange URLs and suddenly i cannot connect to any of my exchange servers again. they all give “412 COOKIES ARE DISABLED”
    Any idea?

  9. Alex

    Hi Paul,

    great script!
    Just something to point out: after the execution, the MAPI authentication settings get lost.
    I don’t think this nothing to do with your script btw, since the settings are lost in any case even if you change the URL within the EAC.
    Keep up the good work!

    Regards,
    Alex

      1. Alex

        2016 standard CU3, v15.1 (build 544.27).
        Thanks,
        Alex

  10. Jean-Luc

    Hi Paul,

    When you do not use “AdPropertiesOnly” there are DCOM errors.
    Do you know why?
    Best regards

    1. Avatar photo
      Paul Cunningham

      No. Sounds like something wrong in your environment though. Using -AdPropertiesOnly just speeds things up a bit.

  11. Ray Hicks

    I used these recently to configure a new 2016 deployment, thank you!

    it maybe worth noting that I had a number of these commands scripted for a 2013 deployment I did a while ago but that did not seem sufficient when I was on this 2016 deployment, so I sought help and found your scripts. After running the scripts I had to recreate the outlook profile on my test machine to clear a certificate error I was getting.

    though I did look through the script I have not bothered to figure what I was missing! These are so good they are my ‘go to’ now.

    cheers.

  12. HB

    what about setting internal and external auth?

  13. Mahmoud

    could you please make other one with
    The default authentication basic

  14. Windozgeek

    Thank you for this, works great.
    Much appreciated

  15. Morteza

    Hi Paul
    I uses your script and change all of URL
    but when outlook want to connect to server again try to connect with local address
    mail.domain.local

    1. Morteza

      and also repeatedly need password

      1. CA

        did you resolve this ?

  16. Juancho

    Hi Paul, thanks for magnificent contribution!

    According to TechNet “If the DefaultAuthenticationMethod parameter is specified, InternalClientAuthenticationMethod, ExternalClientAuthenticationMethodand IISAuthenticationMethodsparameters cannot be used” What if, you need to reverse that and you need/want to use Internal, External and IISAuthentication again?

    Also if you enter Get-OutlookAnywhere | fl DefaultAuthenticationMethod nothing happens. Is there a way to know if DefaultAuthentication has been set?

    Thanks!!

  17. David

    What is the difference between this script and the Virtual Directory configure external access domain tool?

Leave a Reply