Folgende Einträge müssen richtig gesetzt sein, damit Exchange ordentlich funktioniert. Bei Problemen mit einzelnen Diensten, wie z.B. OWA oder Autodiscover, sollten diese Werte geprüft werden.

Die aktuelle Exchange Konfiguration für Autodiscover erhält man mit folgenden Befehlen:

Get-ClientAccessServer | fl autodiscover*
Get-ActiveSyncVirtualDirectory | fl *url*
Get-OutlookAnywhere | fl *hostname
Get-WebServicesVirtualDirectory | fl *url*
Get-OwaVirtualDirectory | fl *url*
Get-OabVirtualDirectory | fl *url*
Get-ECPVirtualDirectory | fl *url*
Get-AutodiscoverVirtualDirectory | fl name, *url*
Get-MapiVirtualDirectory

https://www.frankysweb.de/exchange-2016-urls-und-hostnamen-per-powershell-konfigurieren/

Man setzt die korrekten (Standard) Werte und schon kann es losgehen mit dem Autodiscover:

Set-OWAVirtualDirectory –Identity "OWA (default web site)" -ExternalURL "https://mail.domain.de/OWA" 
Set-OWAVirtualDirectory –Identity "OWA (default web site)" -InternalURL "https://mail.domain.de/OWA"

Set-OABVirtualDirectory –Identity "OAB (default web site)" -ExternalURL "https://mail.domain.de/OAB" 
Set-OABVirtualDirectory –Identity "OAB (default web site)" -InternalURL "https://mail.domain.de/OAB"

Set-ECPVirtualDirectory –Identity "ECP (default web site)" -ExternalURL "https://mail.domain.de/ECP" 
Set-ECPVirtualDirectory –Identity "ECP (default web site)" -InternalURL "https://mail.domain.de/ECP"

Set-WebServicesVirtualDirectory –Identity "EWS (default web site)" -ExternalUrl "https://mail.domain.de/ews/exchange.asmx"
Set-WebServicesVirtualDirectory –Identity "EWS (default web site)" -InternalUrl "https://mail.domain.de/ews/exchange.asmx"

Set-ActiveSyncVirtualDirectory –Identity "Microsoft-Server-ActiveSync (default web site)" -ExternalURL "https://mail.domain.de/Microsoft-Server-ActiveSync"
Set-ActiveSyncVirtualDirectory –Identity "Microsoft-Server-ActiveSync (default web site)" -InternalURL https://mail.domain.de/Microsoft-Server-ActiveSync

Set-ClientAccessServer -AutoDiscoverServiceInternalUri "https://autodiscover.domain.de/Autodiscover/Autodiscover.xml"

Voraussetzungen: Es ist ein SSL-Zertifikat auf dem Exchange Server installiert, welches autodiscover.domain.de und mail.domain.de beinhaltet.

Script zum setzen der Einträge

$servername = "EXCServer"
$internalhostname = "mail.example.de"
$externalhostname = "mail.example.de"
$autodiscoverhostname = "autodiscover.example.de"
$owainturl = "https://" + "$internalhostname" + "/owa"
$owaexturl = "https://" + "$externalhostname" + "/owa"
$ecpinturl = "https://" + "$internalhostname" + "/ecp"
$ecpexturl = "https://" + "$externalhostname" + "/ecp"
$ewsinturl = "https://" + "$internalhostname" + "/EWS/Exchange.asmx"
$ewsexturl = "https://" + "$externalhostname" + "/EWS/Exchange.asmx"
$easinturl = "https://" + "$internalhostname" + "/Microsoft-Server-ActiveSync"
$easexturl = "https://" + "$externalhostname" + "/Microsoft-Server-ActiveSync"
$oabinturl = "https://" + "$internalhostname" + "/OAB"
$oabexturl = "https://" + "$externalhostname" + "/OAB"
$mapiinturl = "https://" + "$internalhostname" + "/mapi"
$mapiexturl = "https://" + "$externalhostname" + "/mapi"
$aduri = "https://" + "$autodiscoverhostname" + "/Autodiscover/Autodiscover.xml"
Get-OwaVirtualDirectory -Server $servername | Set-OwaVirtualDirectory -internalurl $owainturl -externalurl $owaexturl
Get-EcpVirtualDirectory -server $servername | Set-EcpVirtualDirectory -internalurl $ecpinturl -externalurl $ecpexturl
Get-WebServicesVirtualDirectory -server $servername | Set-WebServicesVirtualDirectory -internalurl $ewsinturl -externalurl $ewsexturl
Get-ActiveSyncVirtualDirectory -Server $servername | Set-ActiveSyncVirtualDirectory -internalurl $easinturl -externalurl $easexturl
Get-OabVirtualDirectory -Server $servername | Set-OabVirtualDirectory -internalurl $oabinturl -externalurl $oabexturl
Get-MapiVirtualDirectory -Server $servername | Set-MapiVirtualDirectory -externalurl $mapiexturl -internalurl $mapiinturl
Get-OutlookAnywhere -Server $servername | Set-OutlookAnywhere -externalhostname $externalhostname -internalhostname $internalhostname -ExternalClientsRequireSsl:$true -InternalClientsRequireSsl:$true -ExternalClientAuthenticationMethod 'Negotiate'
Get-ClientAccessService $servername | Set-ClientAccessService -AutoDiscoverServiceInternalUri $aduri