Set Exchange 2010 and 2013 Internal and External Virtual Directory URLs in PowerShell

Here are the elevated PowerShell commands to run to set the virtual directory URLs

Get-ActiveSyncVirtualDirectory -server EXCHANGE | Set-ActiveSyncVirtualDirectory -ExternalUrl ‘https://mail.DOMAIN.ca/Microsoft-Server-ActiveSync’ -InternalUrl ‘https://mail.DOMAIN.ca/Microsoft-Server-ActiveSync’
Get-AutodiscoverVirtualDirectory -server EXCHANGE | Set-AutodiscoverVirtualDirectory -ExternalUrl ‘https://mail.DOMAIN.ca/Autodiscover/Autodiscover.xml’ -InternalUrl ‘https://mail.DOMAIN.ca/Autodiscover/Autodiscover.xml’
Get-ECPVirtualDirectory -server EXCHANGE | Set-ECPVirtualDirectory -ExternalUrl ‘https://mail.DOMAIN.ca/ECP’ -InternalUrl ‘https://mail.DOMAIN.ca/ECP’
Get-OabVirtualDirectory -server EXCHANGE | Set-OabVirtualDirectory -ExternalUrl ‘https://mail.DOMAIN.ca/OAB’ -InternalUrl ‘https://mail.DOMAIN.ca/OAB’
Get-WebServicesVirtualDirectory -server EXCHANGE | Set-WebServicesVirtualDirectory -ExternalUrl ‘https://mail.DOMAIN.ca/EWS/Exchange.asmx’ -InternalUrl ‘https://mail.DOMAIN.ca/EWS/Exchange.asmx’
The elevated PowerShell commands to verify the settings:

Get-ActiveSyncVirtualDirectory | fl internalurl,externalurl
Get-AutoDiscoverVirtualDirectory | fl internalurl,externalurl
Get-ECPVirtualDirectory | fl internalurl,externalurl
Get-OabVirtualDirectory | fl internalurl,externalurl
Get-WebServicesVirtualDirectory | fl internalurl,externalurl
Please note that we run a split DNS setup to have the external URL map to an internal IP address while folks are in the office (as per SBS STD).

Originally posted in 2014 this popular post was migrated over from our previous blog

Make your IT business better than the competition. Help for IT Pros, TechYourBooks, Super Secret News, Women in IT Scholarship program, Ransomware Prevention Kit, 365 Security kit and more. https://www.thirdtier.net

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.