Back to Blog

Exchange Virtual Directory HTML Report

Image of Michael Van Horenbeeck MVP, MCSM
Michael Van Horenbeeck MVP, MCSM
Microsoft Exchange Settings Window

Update 02/13/2014: By popular demand, “Lost modified on:” field has been added which displays the date on which one of the settings on the virtual directory was last modified.

____________________________

Update 02/12/2014: Added some new features to the script. If you add -ADPropertiesOnly when calling the script, it will now only query the ADProperties which processes a whole lot faster in distributed environments. The script now also automatically creates a Remote PowerShell session if it cannot find an active one to use. It will connect to the server you specify with the -ComputerName parameter. If you choose not to specify the parameter, the script will create a remote PowerShell session to the localhost. Thirdly, there’s now also a -Filter parameter which allows you to filter the server(s) for which you want the see the results.

____________________________

The following command would query all CAS’es in the environment which have “02″ in their name and return the ADproperties for the different virtual directories:

Get-VirDirInfo -ReportPath c:\reports -ADPropertiesOnly -Filter *02*

Note: as you can see, I’ve also updated the -FilePath parameter to now be called -ReportPath. Some people reported that the previous name could be a little confusing. I would also like to thank Thomas Torggler for his input. He had some nice ideas!

The download link for the script can be found below.

____________________________

Update 01/30/2013: Based on feedback, I fixed the issue that script threw an error when there was only a single server.

____________________________

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 anymore.

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:

Exchange Settings Window

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:

1
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:

1
. .\get-virdirinfo.ps1

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

1
. $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:

1
2
3
4
5
6
7
8
9
$autodvirdirresult = Get-AutodiscoverVirtualDirectory -Server $server.name | Select InternalUrl,ExternalUrl,InternalAuthenticationMethods,ExternalAuthenticationMethods
$owaresult = Get-OWAVirtualDirectory -server $server.name | Select Name,Server,InternalUrl,ExternalUrl
$ecpresult = Get-ECPVirtualDirectory -server $server.name | Select Name,Server,InternalUrl,ExternalUrl
$oaresult = Get-OutlookAnywhere -server $server.name | Select Name,Server,InternalHostname,ExternalHostname,ExternalClientAuthenticationMethod,
InternalClientAuthenticationMethod,IISAuthenticationMethods
$oabresult = Get-OABVirtualDirectory -server $server.name | Select Server,InternalUrl,ExternalUrl,ExternalAuthenticationMethods,
InternalAuthenticationMethods,OfflineAddressBooks
$easresult = Get-ActiveSyncVirtualDirectory -server $server.name | Select Server,InternalUrl,ExternalUrl,ExternalAuthenticationMethods,
InternalAuthenticationMethods

The gathered is then stored in a separate table and written to an html-file:

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


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! Enjoy!


Lightning Bolt Success

How to Build a SCCM OSD Progress Report to Wow Your Boss - Part 3

Image of ENow Software
ENow Software

If you haven’t read part 1 and part 2 of this article series yet, we recommend you do. Reading...

Read more
person walking in computer server room

Exchange Monitoring: Disk Space

Image of ENow Software
ENow Software

Disk space is vital to the health of an Exchange Server. Without disk, you don’t have email, thus ...

Read more