Pro-Exchange,Lync & Office 365
Belgian Microsoft Unified Communications Professionals
Microsoft Exchange Server, Microsoft Lync Server & Office 365
Exchange Virtual Directory HTML Report


as a consultant, I regularly come across situations in which I have to troubleshoot an existing Exchange server environment or perhaps have to make an assessment, health report, etc.

Almost every time, I found myself looking up the information from the different (commonly used) virtual directories like: Autodiscover, ActiveSync, OWA, ECP, Web Services, OAB… That’s why I thought it became about time I automated this process so that I didn’t have to type the commands in manually.

The result is a simple script which will query the Exchange Client Access Servers in your environment and will query them for their virtual directory information. Depending on the use of the virtual directory, different object are shown:


For now, (version 1.0), the script will only be able to show you information from Exchange 2010 and Exchange 2013. Also, it has to be run from an Exchange Management Shell.

In a future version, the script should also be able to provide results for Exchange 2007 and be ran remotely from a non-Exchange workstation or server.

The script

The script will accept a single parameter to provide the path where the HTML-file should be located. For instance:

Get-VirDirInfo –FilePath c:\reports

As usual, the script contains a function which you can re-use easily by dot-sourcing the script like this:

. .\get-virdirinfo.ps1

There’s no real magic behind the code. First, we look for possible Exchange 2010 & 2013 Client Access Servers:

$servers = Get-ExchangeServer | ?{$_.ServerRole -like "*ClientAccess*" -and (($_.AdminDisplayVersion -like "*15*") -or ($_.AdminDisplayVersion -like "*14*"))} | Select-Object Name

After that, we loop through the results and query for each virtual directory separately:

$autodvirdirresult = Get-AutodiscoverVirtualDirectory -Server $ | Select InternalUrl,ExternalUrl,InternalAuthenticationMethods,ExternalAuthenticationMethods

$owaresult = Get-OWAVirtualDirectory -server $ | Select Name,Server,InternalUrl,ExternalUrl

$ecpresult = Get-ECPVirtualDirectory -server $ | Select Name,Server,InternalUrl,ExternalUrl

$oaresult = Get-OutlookAnywhere -server $ | Select Name,Server,InternalHostname,ExternalHostname,ExternalClientAuthenticationMethod,InternalClientAuthenticationMethod,IISAuthenticationMethods

$oabresult = Get-OABVirtualDirectory -server $ | Select Server,InternalUrl,ExternalUrl,ExternalAuthenticationMethods,InternalAuthenticationMethods,OfflineAddressBooks

$easresult = Get-ActiveSyncVirtualDirectory -server $ | Select Server,InternalUrl,ExternalUrl,ExternalAuthenticationMethods,InternalAuthenticationMethods

Each information is then stored in a separate table and written to an html-file:

$html | Out-File $filepath"\virdirinfo.html"

For your ease, I’ve uploaded the script to Skydrive so you can download it from there: Get-VirDirInfo.ps1

Disclaimer: these scripts are provided “as-is” and are to be used on your own responsibility. I do not accept any liability nor do I take any responsibility for using these scripts in your environment. Please use with caution and always test them before usage!

Posted 12-16-2012 11:50 by Michael Van Horenbeeck