A client recently upgraded their Exchange 2007 environment with cummulative update 18. Upon reboot, the owa was non operational. The quickest fix for a damaged owa is:
Remove-OwaVirtualDirectory “owa (Default Web Site)”
New-OwaVirtualDirectory -OwaVersion "Exchange2007" -Name "Owa (Default Web Site)"
Unfortunately, New-OwaVirtualDirectory was failing with ...InvalidOperationException... There is an article out there about IIS running in 32 bit mode and using the following command to set it in 64 bit mode:
cscript c:\inetpub\adminscripts\adsutil.vbs SET /w3svc/AppPools/Enable32BitAppOnWin64 False
I don't know if that ultimately was necessary or not, but it didn't immediately resolve the issue.
I noticed that the owa virtual directory was being created, but not the AD object required to populate the EMC owa tab (get-owavirtualdirectory). I also saw that IIS was crashing and needed to be restarted after the New-OwaVirtualDirectory command had failed. After many failed attempts, here is what I ended up with.
1) Stop IIS
2) Make a copy of the metabase.xml file (systemroot\system32\inetserv\metabase.xml)
3) Edit the metabase.xml file and removed the 4 (I think) entries for the OWA virtual directory and any OWA sub directories
4) Start IIS, and confirm that OWA virtual dir is not present
5) Run the New-OwaVirtualDirectory -OwaVersion "Exchange2007" -Name "Owa (Default Web Site)" command
6) As soon as IIS crashes, quickly restart IIS <- Time critical procedure
7) New-owavirtualdirectory should finish without error (assuming you are in the same boat I was)
Just one of those things.