How to manage calendar permissions in Office 365 with PowerShell? If you have the correct…
Recreate virtual directories in Exchange Server
Today’s article will show how to recreate virtual directories in Exchange Server. After installing Exchange Server 2016 and looking in IIS Manager, we can see two sites configured. That’s the Default Web Site and the Exchange Back End. If there are issues and you like to reset virtual directories in Exchange Server, you’re at the right place. Read more on how to recreate virtual directories in Exchange Server.
Table of contents
Find and manage virtual directories in Exchange Server
To find and manage virtual directories, you can use:
- IIS Manager
- Exchange Management Shell (EMS)
- Exchange Admin Center (EAC)
Why you want to recreate Exchange virtual directories
Sometimes you have to start from a clean slate, as it will fix most of the problems. Such as:
- Permission problems
- Blank screen
- Missing files
- Connectivity issues
- Page errors
Recreate Exchange virtual directories Default Web Site
Start Internet Information Services (IIS) 6.0 Manager. Exchange Server installation creates two websites:
- Default Web Site
- Exchange Back End
To recreate virtual directories in IIS, we will use PowerShell. We will get the virtual directory, remove the virtual directory, and create the virtual directory. The list is in alphabetic order:
- ActiveSyncVirtualDirectory (Microsoft-Server-ActiveSync)
- AutodiscoverVirtualDirectory (Autodiscover)
- EcpVirtualDirectory (ecp)
- MapiVirtualDirectory (mapi)
- OABVirtualDirectory (OAB)
- OwaVirtualDirectory (owa)
- PowerShellVirtualDirectory (PowerShell)
- WebServicesVirtualDirectory (EWS)
In our example, we will reset the virtual directories on Exchange Server EX01-2016. The internal and external URL is https://mail.exoip.com. We recommend changing the internal and external URLs to a generic namespace.
Read more: Exchange 2016 namespace design and planning »
Recreate ActiveSyncVirtualDirectory
Run Exchange Management Shell as administrator. Recreate Microsoft-Server-ActiveSync virtual directory.
[PS] C:\>Get-ActiveSyncVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, Identity, InternalUrl, ExternalUrl
Server : EX01-2016
Name : Microsoft-Server-ActiveSync (Default Web Site)
Identity : EX01-2016\Microsoft-Server-ActiveSync (Default Web Site)
InternalUrl : https://mail.exoip.com/Microsoft-Server-ActiveSync
ExternalUrl : https://mail.exoip.com/Microsoft-Server-ActiveSync
[PS] C:\>Remove-ActiveSyncVirtualDirectory -Identity "EX01-2016\Microsoft-Server-ActiveSync (Default Web Site)" -Confirm:$false
[PS] C:\>New-ActiveSyncVirtualDirectory -Server "EX01-2016" -InternalUrl "https://mail.exoip.com/Microsoft-Server-ActiveSync" -ExternalUrl "https://mail.exoip.com/Microsoft-Server-ActiveSync"
Name Server InternalUrl
---- ------ -----------
Microsoft-Server-ActiveSync (Default Web Site) EX01-2016 https://mail.exoip.com/Microsoft-Server-ActiveSync
Do you get errors when creating the Exchange virtual directory? Read the article An error occurred while creating the IIS virtual directory.
Recreate AutoDiscoverVirtualDirectory
Recreate Autodiscover virtual directory.
[PS] C:\>Get-AutodiscoverVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, Identity
Server : EX01-2016
Name : Autodiscover (Default Web Site)
Identity : EX01-2016\Autodiscover (Default Web Site)
[PS] C:\>Remove-AutodiscoverVirtualDirectory -Identity "EX01-2016\Autodiscover (Default Web Site)" -Confirm:$false
[PS] C:\>New-AutodiscoverVirtualDirectory -Server "EX01-2016" -BasicAuthentication $true -WindowsAuthentication $true
Name Server InternalUrl
---- ------ -----------
Autodiscover (Default Web Site) EX01-2016
[PS] C:\>Set-ClientAccessServer -Identity "EX01-2016" -AutodiscoverServiceInternalUri https://autodiscover.exoip.com/Autodiscover/Autodiscover.xml
Learn more about Autodiscover in Exchange Server:
- Configure autodiscover URL in Exchange with PowerShell
- Find autodiscover URL in Exchange with PowerShell
Recreate EcpVirtualDirectory
Recreate ecp virtual directory.
[PS] C:\>Get-EcpVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, InternalUrl, ExternalUrl, Identity
Server : EX01-2016
Name : ecp (Default Web Site)
InternalUrl : https://mail.exoip.com/ecp
ExternalUrl : https://mail.exoip.com/ecp
Identity : EX01-2016\ecp (Default Web Site)
[PS] C:\>Remove-EcpVirtualDirectory -Identity "EX01-2016\ecp (Default Web Site)" -Confirm:$false
[PS] C:\>New-EcpVirtualDirectory -Server "EX01-2016" -InternalUrl "https://mail.exoip.com/ecp" -ExternalUrl "https://mail.exoip.com/ecp"
Name Server
---- ------
ecp (Default Web Site) EX01-2016
Recreate MapiVirtualDirectory
Recreate mapi virtual directory.
[PS] C:\>Get-MapiVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, InternalUrl, ExternalUrl, Identity
Server : EX01-2016
Name : mapi (Default Web Site)
InternalUrl : https://mail.exoip.com/mapi
ExternalUrl : https://mail.exoip.com/mapi
Identity : EX01-2016\mapi (Default Web Site)
[PS] C:\>Remove-MapiVirtualDirectory -Identity "EX01-2016\mapi (Default Web Site)" -Confirm:$false
[PS] C:\>New-MapiVirtualDirectory -Server "EX01-2016" -InternalUrl https://mail.exoip.com/mapi -ExternalUrl https://mail.exoip.com/mapi -IISAuthenticationMethods Ntlm, OAuth, Negotiate
Name Server InternalUrl ExternalUrl
---- ------ ----------- -----------
mapi (Default Web Site) EX01-2016 https://mail.exoip.com/mapi https://mail.exoip.com/mapi
Recreate OABVirtualDirectory
Recreate OAB virtual directory.
[PS] C:\>Get-OabVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, InternalUrl, ExternalUrl, Identity
Server : EX01-2016
Name : OAB (Default Web Site)
InternalUrl : https://mail.exoip.com/OAB
ExternalUrl : https://mail.exoip.com/OAB
Identity : EX01-2016\OAB (Default Web Site)
[PS] C:\>Remove-OabVirtualDirectory -Identity "EX01-2016\OAB (Default Web Site)" -Confirm:$false -Force
[PS] C:\>New-OabVirtualDirectory -Server "EX01-2016" -InternalUrl "https://mail.exoip.com/OAB" -ExternalUrl "https://mail.exoip.com/OAB"
Server Name Internal Url External Url
------ ---- ------------ ------------
EX01-2016 OAB (Default Web Site) https://mail.exoip.com/OAB https://mail.exoip.com/OAB
Recreate OwaVirtualDirectory
Recreate owa virtual directory.
[PS] C:\>Get-OwaVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, InternalUrl, ExternalUrl, Identity
Server : EX01-2016
Name : owa (Default Web Site)
InternalUrl : https://mail.exoip.com/owa
ExternalUrl : https://mail.exoip.com/owa
Identity : EX01-2016\owa (Default Web Site)
[PS] C:\>Remove-OwaVirtualDirectory -Identity "EX01-2016\owa (Default Web Site)" -Confirm:$false
[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
Recreate PowerShellVirtualDirectory
Recreate PowerShell virtual directory.
You must open PowerShell or PowerShell ISE and run the following cmdlets. That’s because you can’t recreate a PowerShell virtual directory if you are in a session (Exchange Management Shell). The first cmdlet will load the Microsoft Exchange Management Powershell Snapin.
PS C:\> Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
PS C:\> Get-PowerShellVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, InternalUrl, Externalurl, Identity
Server : EX01-2016
Name : Powershell (Default Web Site)
InternalUrl : https://mail.exoip.com/PowerShell
ExternalUrl : https://mail.exoip.com/PowerShell
Identity : EX01-2016\Powershell (Default Web Site)
PS C:\> Remove-PowerShellVirtualDirectory -Identity "EX01-2016\PowerShell (Default Web Site)" -Confirm:$false
PS C:\> New-PowerShellVirtualDirectory -Server "EX01-2016" -Name Powershell -InternalUrl https://www.mail.exoip.com/PowerShell -ExternalUrl https://mail.exoip.com/PowerShell -RequireSSL:$false
Name Server
---- ------
Powershell (Default Web Site) EX01-2016
Recreate WebServicesVirtualDirectory
Recreate EWS virtual directory.
[PS] C:\>Get-WebServicesVirtualDirectory -Server "EX01-2016" | Format-List Server, Name, InternalUrl, ExternalUrl, Identity
Server : EX01-2016
Name : EWS (Default Web Site)
InternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
ExternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
Identity : EX01-2016\EWS (Default Web Site)
[PS] C:\>Remove-WebServicesVirtualDirectory -Identity "EX01-2016\EWS (Default Web Site)" -Confirm:$false -Force
WARNING: Outlook Web App won't function correctly if you remove the Exchange Web Services virtual directory "EX01-2016\EWS (Default Web Site)". To disable Exchange Web Services without blocking access to Outlook Web
App, you can use "Set-CASMailbox -Identity -EwsEnabled:$false" or "Set-OrganizationConfig -Identity -EwsEnabled:$false".
[[PS] C:\>New-WebServicesVirtualDirectory -Server "EX01-2016" -InternalUrl "https://mail.exoip.com/EWS/Exchange.asmx" -ExternalUrl "https://mail.exoip.com/EWS/Exchange.asmx"
Name Server InternalUrl
---- ------ -----------
EWS (Default Web Site) EX01-2016 https://mail.exoip.com/EWS/Exchange.asmx
Restart IIS or reboot the Exchange Server.
Verify virtual directories in Exchange Admin Center
Open your favorite browser and log in to Exchange Server Admin Center (EAC). The localhost link is https://localhost/ecp. In the feature pane, click servers and click in the tabs on virtual directories. Select the server that you recreated the virtual directories on.
The Exchange virtual directories are recreated and showing successfully. Did it work for you?
Keep reading: Recreate arbitration mailboxes in Exchange Server »
Conclusion
In this article, you learned how to recreate virtual directories in Exchange Server. We did reset Exchange virtual directories with PowerShell. The cmdlets did get the virtual directory, remove the virtual directory and, as of last, create the virtual directory. It’s always good to check the virtual directories in Exchange Admin Center to verify if they are created.
Did you enjoy this article? You may also like Recreate audit log mailbox in Exchange Server. Don’t forget to follow us and share this article.
This Post Has 0 Comments