We see a mailbox with a different mailbox type in Exchange on-premises and Exchange Online.…
An error occurred while creating the IIS virtual directory
We are unable to recreate Exchange virtual directory in Exchange Management Shell, and a couple of errors are showing. An error occurred while creating the IIS virtual directory. The AD configuration for virtual directory already exists. This article will show why it’s happening and the solution to recreate Exchange IIS virtual directory.
Table of contents
- Recreate owa virtual directory in Exchange Server
- The AD configuration for virtual directory ‘owa’ already exists
- Solution for the AD configuration for virtual directory ‘owa’ already exists
- An error occurred while creating the IIS virtual directory
- Solution for an error occurred while creating the IIS virtual directory
- Check if OWA is working
- Conclusion
Recreate owa virtual directory in Exchange Server
In the previous post, we already discussed how to recreate Exchange virtual directories. If you do it step by step, that works wonders. If you don’t follow the steps or impossible to follow, you can get errors when recreating the virtual directories.
In this example, the owa virtual directory is removed in Exchange Server. We like to recreate the owa virtual directory in IIS. If you have another virtual directory that you want to recreate, for example, the ecp virtual directory, you can follow the same steps. It applies to all Exchange virtual directories.
The AD configuration for virtual directory ‘owa’ already exists
Run Exchange Management Shell as administrator. Run the cmdlet and add the server name and the domain to both of the URLs. In our example, the Exchange Server and internal DNS are https://mail.exoip.com/owa.
Read more: Exchange namespace design and planning »
The following error shows up: The AD configuration for virtual directory ‘owa’ already exists.
[PS] C:\>New-OwaVirtualDirectory -Server "EX01-2016" -InternalUrl "https://mail.exoip.com/owa" -ExternalUrl "https://mail.exoip.com/owa"
The AD configuration for virtual directory 'owa' already exists in 'CN=owa (Default Web
Site),CN=HTTP,CN=Protocols,CN=EX01-2016,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative
Groups,CN=EXOIP,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=exoip,DC=local', please remove this AD
configuration manually.
Parameter name: VirtualDirectoryName
+ CategoryInfo : InvalidArgument: (EX01-2016\owa (Default Web Site):ADObjectId) [New-OwaVirtualDirectory],
ArgumentException
+ FullyQualifiedErrorId : [Server=EX01-2016,RequestId=b17941d0-7003-4bd3-bf8e-ac3a6856304f,TimeStamp=9/27/2020 9:10
:05 PM] [FailureCategory=Cmdlet-ArgumentException] 175231A,Microsoft.Exchange.Management.SystemConfigurationTasks.N
ewOwaVirtualDirectory
+ PSComputerName : ex01-2016.exoip.local
Why do we get the error that the AD configuration for virtual directory ‘owa’ already exists and we have to remove this AD configuration manually?
Solution for the AD configuration for virtual directory ‘owa’ already exists
That’s because it’s not removed the right way through Exchange Management Shell (EMS) with the Remove-OwaVirtualDirectory cmdlet. For example, it’s removed from IIS with a right-click on the virtual directory and remove.
Note: Don’t remove the Exchange virtual directory from IIS Manager. Use the Exchange Management Shell instead.
There are two options. One of them is to remove it with EMS. The other one is with ADSI Edit.
Option 1: Remove owa virtual directory with EMS
Run Exchange Management Shell as administrator. Run the cmdlet to remove the owa virtual directory.
[PS] C:\>Remove-OwaVirtualDirectory -Identity "EX01-2016\owa (Default Web Site)" -Confirm:$false
Option 2: Remove owa virtual directory with ADSI Edit
Start ADSI Edit. Right-click ADSI Edit in the left pane and select Connect to. Select Configuration in the well known naming Context. Click OK.
Navigate in ADSI Edit:
Configuration > CN=Configuration,DC=exoip,DC=local > CN=Services > CN=Microsoft Exchange > CN=EXOIP > CN=Administrative Groups > CN=Exchange Administrative Group (FYDIBOHF23SPDLT) > CN=Servers > CN=EX01-2016 > CN=Protocols > CN=HTTP.
Delete CN=owa (Default Web Site).
In the next step, we will recreate the Exchange virtual directory.
An error occurred while creating the IIS virtual directory
In the previous step, we removed the virtual directory in EMS or with ADSI Edit. Let’s create the owa virtual directory in EMS.
This time another error shows up: An error occurred while creating the IIS virtual directory.
[PS] C:\>New-OwaVirtualDirectory -Server "EX01-2016" -InternalUrl "https://mail.exoip.com/owa" -ExternalUrl "https://mail.exoip.com/owa"
An error occurred while creating the IIS virtual directory 'IIS://EX01-2016.exoip.local/W3SVC/1/ROOT/owa' on
'EX01-2016'.
+ CategoryInfo : InvalidOperation: (EX01-2016\owa (Default Web Site):ADObjectId) [New-OwaVirtualDirectory]
, InvalidOperationException
+ FullyQualifiedErrorId : [Server=EX01-2016,RequestId=db174f91-9437-4b28-8be6-c90d19c1b3cd,TimeStamp=9/27/2020 6:58
:59 PM] [FailureCategory=Cmdlet-InvalidOperationException] 6234EC08,Microsoft.Exchange.Management.SystemConfigurati
onTasks.NewOwaVirtualDirectory
+ PSComputerName : ex01-2016.exoip.local
Why do we get an error occurred while creating the IIS virtual directory?
Solution for an error occurred while creating the IIS virtual directory
That’s because we did fix the issue in the last part, but there are leftovers in the IIS internal database called MetaBase. If we removed the virtual directory immediately with EMS, this error would not show up.
Install Microsoft Metabase Explorer 1.6
To look into the IIS database, we are going to use Microsoft Metabase Explorer 1.6. It’s part of the IIS 6.0 Resource Kit, which provides a graphical user interface (GUI) to view and edit local and remote IIS Metabase stores.
Download the IIS 6 Resource Kit (Microsoft) or here (direct link). Install Microsoft Metabase Explorer 1.6 on the Exchange Server.
Right-click on iis60rkt.exe, go to Properties, and check the checkbox Unblock (if available). Click OK.
Right-click the setup and click Run as administrator. Click Next. Agree to the EULA and select Next. Fill out User Name and Company Name and click Next. Select Custom setup type and click Next.
Deselect all options except Metabase Explorer 1.6 and click Next.
Click Next, and when it’s done installing, click Finish.
Run Microsoft Metabase Explorer
Start Microsoft Metabase Explorer 1.6. Do you get the window that the feature .NET Framework 3.5 couldn’t be installed? Read the article Install .NET Framework 3.5 on Windows Server.
After starting the program, you can see that you are looking at the same structure as the Internet Information Services (IIS) Manager that you are familiar with.
IIS Metabase Explorer
Internet Information Services (IIS) Manager
Remove owa from IIS Metabase Explorer
Go to the path: /LM/W3SVC/1/ROOT/owa/. Right-click on owa and click Delete.
Run the cmdlet to recreate the OWA virtual directory. This time you will not get An error occurred while creating the IIS virtual directory. After that, restart IIS.
[PS] C:\>New-OwaVirtualDirectory -Server "EX01-2016" -InternalUrl "https://mail.exoip.com/owa" -ExternalUrl "https://mail.exoip.com/owa"
Name Server OwaVersion
---- ------ ----------
owa (Default Web Site) EX01-2016 Exchange2013
[PS] C:\> iisreset
Check if OWA is working
We can always verify in IIS Metabase Explorer that the data is recreated.
On the Exchange Server, browse to the OWA page URL https://FQDN/owa. In our example https://ex01-2016.exoip.local/owa. Or you can sign in with the URL that you filled in the cmdlet to create the owa virtual directory. Both will work.
The Exchange Outlook Web Access (OWA) page did show up successfully. Did it work for you?
Keep reading: Exchange 2016 OWA your connection is not secure »
Conclusion
In this article, you learned why you are unable to recreate Exchange virtual directory. Don’t remove the virtual directory in IIS Manager as this will give you errors when recreating the virtual directory. Remove it with Exchange Management Shell with the correct cmdlet. If you do get an error, follow the steps to remove the virtual directory with MetaBase Explorer. Recreate the virtual directory in EMS to bring the virtual directory back to life.
Did you enjoy this article? You may also like Server Error in ‘/owa’ Application Exchange Server. Don’t forget to follow us and share this article.
This Post Has 0 Comments