The following script can be used to specify the URLs and host names of an Exchange 2016 server:
#Hostname für Exchange Webservices, OWA, Outlook Anywhere, Active Sync: $OutlookHostname = "outlook.frankysweb.de" #Hostname für Autodiscover: $AutodiscoverHostname = "autodiscover.frankysweb.de" #OWA $owa = "https://" + "$OutlookHostname" + "/owa" write-host "OWA URL:" $owa Get-OwaVirtualDirectory -Server $env:computername | Set-OwaVirtualDirectory -internalurl $owa -externalurl $owa -wa 0 #ECP $ecp = "https://" + "$OutlookHostname" + "/ecp" write-host "ECP URL:" $ecp Get-EcpVirtualDirectory -server $env:computername| Set-EcpVirtualDirectory -internalurl $ecp -externalurl $ecp #EWS $ews = "https://" + "$OutlookHostname" + "/EWS/Exchange.asmx" write-host "EWS URL:" $ews Get-WebServicesVirtualDirectory -server $env:computername | Set-WebServicesVirtualDirectory -internalurl $ews -externalurl $ews -confirm:$false -force #ActiveSync $eas = "https://" + "$OutlookHostname" + "/Microsoft-Server-ActiveSync" write-host "ActiveSync URL:" $eas Get-ActiveSyncVirtualDirectory -Server $env:computername | Set-ActiveSyncVirtualDirectory -internalurl $eas -externalurl $eas #OfflineAdressbuch $oab = "https://" + "$OutlookHostname" + "/OAB" write-host "OAB URL:" $oab Get-OabVirtualDirectory -Server $env:computername | Set-OabVirtualDirectory -internalurl $oab -externalurl $oab #MAPIoverHTTP $mapi = "https://" + "$OutlookHostname" + "/mapi" write-host "MAPI URL:" $mapi Get-MapiVirtualDirectory -Server $env:computername| Set-MapiVirtualDirectory -externalurl $mapi -internalurl $mapi #Outlook Anywhere (RPCoverhTTP) write-host "OA Hostname:" $OutlookHostname Get-OutlookAnywhere -Server $env:computername| Set-OutlookAnywhere -externalhostname $OutlookHostname -internalhostname $OutlookHostname -ExternalClientsRequireSsl:$true -InternalClientsRequireSsl:$true -ExternalClientAuthenticationMethod 'Negotiate' -wa 0 #Autodiscover SCP $autodiscover = "https://" + "$AutodiscoverHostname" + "/Autodiscover/Autodiscover.xml" write-host "Autodiscover URL:" $autodiscover Get-ClientAccessService $env:computername | Set-ClientAccessService -AutoDiscoverServiceInternalUri $autodiscover
After line 2 and line 4 have been adjusted, the script can be executed on any Exchange 2016 server that is to receive the settings. To execute the script, it can be copied to a .PS1 file, which is then executed with the Exchange Management Shell:
The script configures internal and external URLs or internal and external host names identically.
The certificates can then be configured with the host names specified in line 2 and line 4. You can check whether all Exchange servers have the correct URLs using the script from this article:
Exchange 2016: Determine DNS names for certificates (Quick & Dirty)