Setup Exchange Virtual Directories using PowerShell
OWA
Set-OwaVirtualDirectory
Set-OWAVirtualDirectory –Identity "OWA (default web site)" -ExternalURL "https://mail.muatazawad.com/OWA"
Set-OWAVirtualDirectory –Identity "OWA (default web site)" -InternalURL "https://mail.muatazawad.com/OWA"
OAB
Set-OABVirtualDirectory
Set-OABVirtualDirectory –Identity "OAB (default web site)" -ExternalURL "https://mail.muatazawad.com/OAB"
Set-OABVirtualDirectory –Identity "OAB (default web site)" -InternalURL "https://mail.muatazawad.com/OAB"
ECP
Set-ECPVirtualDirectory
Set-ECPVirtualDirectory –Identity "ECP (default web site)" -ExternalURL "https://mail.muatazawad.com/ECP"
Set-ECPVirtualDirectory –Identity "ECP (default web site)" -InternalURL "https://mail.muatazawad.com/ECP"
EWS
Set-WebServicesVirtualDirectory
Set-WebServicesVirtualDirectory –Identity "EWS (default web site)" -ExternalUrl "https://mail.muatazawad.com/ews/exchange.asmx"
Set-WebServicesVirtualDirectory –Identity "EWS (default web site)" -InternalUrl "https://mail.muatazawad.com/ews/exchange.asmx"
ActiveSync
Set-ActiveSyncVirtualDirectory
Set-ActiveSyncVirtualDirectory –Identity "Microsoft-Server-ActiveSync (default web site)" -ExternalURL "https://mail.muatazawad.com/Microsoft-Server-ActiveSync"
Set-ActiveSyncVirtualDirectory –Identity "Microsoft-Server-ActiveSync (default web site)" -InternalURL https://mail.muatazawad.com/Microsoft-Server-ActiveSync
Autodiscover
Set-AutodiscoverVirtualDirectory
Not enabled as default. Please note that autodiscover must be set as an A-record in your DNS. Also note that you do not provide an url for this.
Set-ClientAccessServer -Identity ex2013 -AutoDiscoverServiceInternalURI https://mail.muatazawad.com/Autodiscover/Autodiscover.xml
Set-AutodiscoverVirtualDirectory -Identity 'Autodiscover (Default Web Site)' -WindowsAuthentication $false -BasicAuthentication $false -DigestAuthentication $true
MAPI/HTTP
MAPI over HTTP
Not enabled as default. Requires Exchange 2013 SP1. Clients must be Outlook 2013 or newer. Fallback is OutlookAnywhere for older clients.
Set-MapiVirtualDirectory -Identity "mapi (Default Web Site)" -InternalUrl "https://mail.muatazawad.com/mapi" -IISAuthenticationMethods NTLM,Negotiate
After setting up the Virtual Directory you need to enable it:
Set-OrganizationConfig -MapiHttpEnabled $true