A common practice is to redirect the default website to the OWA site in IIS. This allows for a shorter URL for users to remember, and catches those who don’t append “/owa “. It’s a simple enough task for an administrator to do, but I wanted to script it so that I could include it in other Exchange 2010 build scripts to help streamline the process.
Another common practice is to force SSL on specific virtual directories to help enhance security of client access to Exchange. This can take a few extra minutes, but can easily be scripted as well, so I combined both into a simple script. Some of the initial code came from colleague and Exchange Ranger Mark Smith, but I converted it to PowerShell, and added some checks and balances.
Run the script after installing Exchange, and pass it the destination to forward to. An example would be
1 |
.\ Set -Exchange2010RedirectSSL.ps1 -url "https://mail.ehloworld.com/owa" |
This will redirect the root site to the URL listed. If you don’t specify the ForceSSL option, it will automatically secure the recommended virtual directories. To override that, set it to $false, such as
1 |
.\ Set -Exchange2010RedirectSSL.ps1 -url "https://mail.ehloworld.com/owa" -ForceSSL $false |
The script starts by verifying the web-http-redirect feature is installed. If not, it will install it. Then, the script will backup the current IIS config, apply the changes, then do an IISRESET for them to take effect.
Like my other scripts, running it requires that you set the execution policy in EMS to either “remotesigned” or “unrestricted” to allow unsigned scripts to run. To do so, open EMS and type
1 |
Set-ExecutionPolicy RemoteSigned |
or
1 |
Set-ExecutionPolicy unrestricted |
If you’re not sure of how to run it, there is built in help. Just run
1 |
Get-Help .\ Set -Exchange2010RedirectSSL.ps1 |
UPDATE: I forgot to mention that the script also assigns permissions to the web.config file for the Offline Address Book to resolve a problem where downloading of the OAB would stop in the middle after configuring HTTP redirection. Microsoft Exchange PFE Bhargav Shukla has pointed out that this was mentioned in fellow MVP Henrik Walther’s post OAB issues after simplifying the OWA 2010 URL? As mentioned earlier, I got intial code from someone else, and didn’t realize that Henrik had already posted about it. So rather than go into details on the issue, please visit Henrik’s excellent post if you’d like more info. Thanks to both Henrik and Bhargav.
Download
v1.2 Set-Exchange2010RedirectSSL.v1.2.zip
v1.0 Set-Exchange2010RedirectSSL.zip