During a recent update to Exchange 2016 CU9, I encountered the following error whilst trying to recreate one of the secondary OWA sites that I have running.
The command being executed was:
New-OwaVirtualDirectory -Server $ServerName -WebsiteName "EAC_Secondary" | Out-Null
The error I was getting:
An error occurred while creating the IIS virtual directory 'IIS://exch04.domain.local/W3SVC/3/ROOT/owa' on 'exch04'.
+ CategoryInfo : InvalidOperation: (exch04\owa (EAC_Secondary):ADObjectId) [New-OwaVirtualDirectory], InvalidOperationException
+ FullyQualifiedErrorId : [Server=exch04,RequestId=8d989c2d-4c79-4c5c-932d-5cc97804b721,TimeStamp=08/05/2018 14:09:13] [FailureCategory=Cmdlet-InvalidOperationException] 628F3B52,Microsoft.Exchange.Management.SystemConfigurationTasks.NewOwaVirtualDirectory
+ PSComputerName : exch04.domain.local
The usual suspect is that the object was not cleanly removed from the domain, so remove the object using ADSI, wait for replication and then carry on. In this case though, the object did not exist in the domain, not was there any trace of the site when browsing the IIS Admin Console.
The hint for me, was when checking the error in the Event Log, under Applications and Services Logs –> Microsoft –> Exchange. The error entry showed one more key bit of information – the error code was 0x800700B7 – which translates to ‘Cannot create a file when that file already exists’.
With this information, it told me that the cmdlet could not create the IIS virtual directory as it already exists. Sure enough, checking the IIS applicationHost.config file, the site still existed.
So, in my case, the fix was:
- Run notepad as administrator
- Open ‘C:\Windows\System32\inetsrv\config\applicationHost.config’
- Search for the site in the error, in my case ‘W3SVC/3/ROOT/owa’
- Comment out the section. In my case I commented out:
<!--<key path="LM/W3SVC/3/ROOT/owa"> <property id="2102" dataType="String" userType="100" attributes="Inherit" value="owa" /> <property id="45054" dataType="DWord" userType="1" attributes="Inherit" value="1" /> </key> <key path="LM/W3SVC/3/ROOT/owa/auth"> <property id="1002" dataType="String" userType="1" attributes="None" value="IIsWebDirectory" /> </key>-->
- Save the file
- Restart IIS
- Attempt to create the directory again
I am bashing my freakin face in trying to figure this out. I am getting the same error when i try to create the OWA in a specific website. My IIS server has 3 web sites on it, only one is available publically. So i can create OWA on default web site and a TestOWA website i created with no problems. When i try to deploy it to the Team Foundation Server website, it fails with the error above. I have tried to go through the exchange logs like you mentioned however i have quite a few subdirectories under exchange and a multitude of different log files under there as well. Digging through them, i cant see anything related to or even time stamped near where this error is occuring. I have went in and commented out the data like you did in your file and that doesnt seem to make a different either.
Thoughts?
Not sure what else to suggest – I would have been hopeful for an error in the Exchange Event Log to point in the right direction. Have you already been through AD as per this guide: https://exchangemaster.wordpress.com/2016/07/01/unable-to-recreate-exchange-virtual-directory/?
If you do find out what it is I would really like to know.
Thanks for the link above, using Metabase Explorer fixed my Exchange 2013 issue when recreating OWA and ECP.