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 because I had to copy protect everything. Jerks.