Below is a script designed to aid admins with setting External URLs on exchange server. Currently this is an initial version with no features or frills. It simply builds External URL Configuration cmdlets base on server name and root URL.
You’ll note that this script is much shorter than other versions out there. This is because I am using an array of hash tables to store and access the unique portions of the URLs. A counter lets the script cycle through each VDir to generate and run the necessary commands. Note: version 1 doesn’t include the Powershell URL, since that one uses HTTP instead of HTTPS.
One last thing to note is that this only works on Exchange 2016 due to the removal of the RPC endpoint in IIS.
I’ve moved this script to my Technet Gallery. You can thank the jerks who copied and pasted my articles to their own blogs for this code not being here any longer, but it’s in a better place.
Learn More About Autodiscover
Virtual Directory information is a part of what Autodiscover provides Outlook, so you will want to learn more about Autodiscover by reading these articles:
Configure Exchange Autodiscover
Exchange Autodiscover – The Active Directory SCP
Configuring Autodiscover for Internal DNS
QuickPost: What do Exchange Virtual Directories Do?
Configuring Exchange Virtual Directories
Fixing Outlook Certificate Errors
Controlling Autodiscover with Registry or GPO
Autodiscover – Microsoft Docs