How to Recreate all Virtual Directories for Exchange 2007


Here you will find all commands what would help you to recreate all Virtual Directories for Exchange 2007. You can also use just a few of them. But never delete or create it in IIS. This has to be done under Exchange Management Shell

First you shall write down the information what you will get (for example: if it "Default Web Site" or "SBS Web Applications" and if they have the information, what InternalURL or External URL is configured):

- Open Exchange Management Shell with elevated permission
- Run the following commands:

Get-AutodiscoverVirtualDirectory
Get-OABVirtualDirectory
Get-OWAVirtualDirectory
Get-WebServicesVirtualDirectory
Get-ActiveSyncVirtualDirectory
Get-UMVirtualDirectory

Then you can remove the Virtual Directories but change the ####### to the information you got earlier

Remove-OWAVirtualDirectory -Identity "Owa (#######)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Exadmin (#######)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Exchange (#######)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Exchweb (#######)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Public (#######)" -Confirm:$false
Remove-WebServicesVirtualDirectory -Identity "EWS (#######)" -Confirm:$false
Remove-ActiveSyncVirtualDirectory -Identity "Microsoft-Server-ActiveSync (#######)" -Confirm:$false
Remove-OabVirtualDirectory -Identity "OAB (#######)" -Force:$true -Confirm:$false
Remove-UMVirtualDirectory -Identity "UnifiedMessaging (#######)" -Confirm:$false
Remove-AutodiscoverVirtualDirectory -Identity "Autodiscover (#######)" -Confirm:$false

To verify that the directories have been removed, run the following commands. You should receive no output:

Get-AutodiscoverVirtualDirectory
Get-OABVirtualDirectory
Get-OWAVirtualDirectory
Get-WebServicesVirtualDirectory
Get-ActiveSyncVirtualDirectory
Get-UMVirtualDirectory

To properly create these virtual directories, run the following commands (Please keep the information what you got earlier for ####### and change it here to):

- Open Exchange Management Shell with elevated permission
- Run the following commands:

New-OWAVirtualDirectory -WebsiteName "#######" -OwaVersion "Exchange2007"
-ExternalAuthenticationMethods Fba

Set-OWAVirtualDirectory -InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/owa/"
-ClientAuthCleanupLevel "Low" -LogonFormat "UserName" -DefaultDomain “NetBiosDomainName”
-Identity "Owa (#######)"

New-OWAVirtualDirectory -WebsiteName "#######" -OwaVersion "Exchange2003or2000"
-VirtualDirectoryType "Exadmin" -ExternalAuthenticationMethods Fba

New-OWAVirtualDirectory -WebsiteName "#######" -OwaVersion "Exchange2003or2000"
-VirtualDirectoryType "Mailboxes" -ExternalAuthenticationMethods Fba

New-OWAVirtualDirectory -WebsiteName "#######" -OwaVersion "Exchange2003or2000"
-VirtualDirectoryType "Exchweb" -ExternalAuthenticationMethods Fba

New-OWAVirtualDirectory -WebsiteName "#######" -OwaVersion "Exchange2003or2000"
-VirtualDirectoryType "PublicFolders" -ExternalAuthenticationMethods Fba

New-WebServicesVirtualDirectory -WebsiteName "#######"
-InternalUrl "https://Internal_FQDN_OF_EXCHANGE/EWS/Exchange.asmx" -basicauthentication 1
-windowsauthentication 1

New-ActiveSyncVirtualDirectory -WebsiteName "#######"
-InternalUrl "https://Internal_FQDN_OF_EXCHANGE/Microsoft-Server-ActiveSync"
-ExternalAuthenticationMethods Basic -InternalAuthenticationMethods Basic

New-OabVirtualDirectory -WebsiteName "#######" -InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/OAB"

Set-OabVirtualDirectory -PollInterval "30" -Identity "oab (#######)"

New-UMVirtualDirectory -WebsiteName "#######" -InternalUrl "https://Internal_FQDN_OF_EXCHANGE/UnifiedMessaging/Service.asmx"

New-AutodiscoverVirtualDirectory -WebsiteName "#######"
-InternalUrl "https://Internal_FQDN_OF_EXCHANGE/Autodiscover/Autodiscover.xml"
-BasicAuthentication 1 -WindowsAuthentication 1

Set-ClientAccessServer -Identity “Servername” -AutoDiscoverServiceInternalUri "https://Internal_FQDN_OF_EXCHANGE2007/Autodiscover/Autodiscover.xml"

Set-OfflineAddressBook "Default Offline Address Book" -VirtualDirectories "Servername\OAB (#######)" -Versions Version2,Version3,Version4)"

- To check if we were successful in creating the virtual directories correctly type in the commands:

Get-AutodiscoverVirtualDirectory
Get-OABVirtualDirectory
Get-OWAVirtualDirectory
Get-WebServicesVirtualDirectory
Get-ActiveSyncVirtualDirectory
Get-UMVirtualDirectory

* Keep in mind if you run -
New-ActiveSyncVirtualDirectory
New-OabVirtualDirectory
New-OWAVirtualDirectory
It will create the Virtual Directories if you are running single server in the environment.

Leave a Reply

EXCHANGE RANGER