Problem: You want to have separate URLs pointing to two different domain names, with SSL, and both pointing to the same Exchange server.
Environment: Exchange 2007 on Server 2008 with IIS7.
Usage Scenario: Your e-mail domain has two (or more) e-mail domains, and users in both domains want to use their own domain names to access OWA. For example, users with domain1.com e-mail addresses want to go to https://remote.domain1.com/owa, and users with domain2.com e-mail addresses want to go to https://remote.domain2.com/owa to access their e-mail.
In Exchange 2003/IIS6, you might have done some crazy metabase manipulations, such as exporting the entire website to a file, then reading it, and choosing to import the /exchange subfolder only.
Well, it’s actually somewhat simpler than that with Exchange 2007/IIS7.
Here’s what to do:
1. Open Exchange Management Shell with elevated permissions.
2. Paste this command into the shell:
New-OWAVirtualDirectory -OwaVersion:Exchange2007 -ExternalUrl:https://remote.domain2.com -InternalUrl:https://remote.domain2.com -Name “owa” -WebSiteName “Domain2.com”
Change the parameters in this command to match your environment, of course.
This command makes some assumptions:
a. Your external and internal URLs to access the website are the same. You could use different ones at this point. It’s up to you.
b. Domain1.com already has OWA enabled. So, we’re adding the OWA virtual directory to Domain2.com.
If you’re experimenting with this, and you make a mistake, DO NOT delete the virtual directory from the website using IIS Admin. Instead, use this command in Exchange Management Shell:
Remove-OwaVirtualDirectory -Identity “owa (Domain2.com)”
This will not only remove the virtual directory, but also fix some behind-the-scenes stuff that would have bitten you if you had deleted the virtual directory (voice of experience here).
Here is a Technet article with the complete command reference for the New-OWAVirtualDirectory command, and some related ones.
Updated - Here is a related command to add the ActiveSync virtual directory as well:
New-ActiveSyncVirtualDirectory -WebSiteName “YourWebSite” -ExternalURL “http://YourAccessURL/Microsoft-Server-ActiveSync“
If this gets out of sync, you can use this command to remove it:
Remove-ActiveSyncVirtualDirectory “Microsoft-Server-ActiveSync (YourWebSiteName)“
Tags: Exchange, IIS7, Outlook Web Access, Virtual Directory