Exchange - Get-VirtualDirectory cmdlets take a long time to run in Exchange Server

In a Microsoft Exchange Server environment, you run one of the following cmdlets to obtain the properties of a virtual directory for a server in another site that's connected over a wide area network (WAN): 

Get-WebServicesVirtualDirectory
Get-OwaVirtualDirectory
Get-ActiveSyncVirtualDirectory
Get-AutodiscoverVirtualDirectory
Get-EcpVirtualDirectory
Get-PowerShellVirtualDirectory
Get-OABvirtualDirectory

However, the cmdlet takes much longer than expected to run (about 15 minutes).

Workarond:

To work around this issue, use the AdPropertiesOnly switch with the cmdlet in the calls to the IIS metabase. 

Example 1
Get-OwaVirtualDirectory -Server Contoso –AdpropertiesOnly
Example 2
Get-OwaVirtualDirectory -Identity "Contoso\owa (default Web site)" –AdpropertiesOnly
The ADPropertiesOnlyswitch specifies that only the virtual directory properties that are stored in Active Directory Domain Services (AD DS) are returned. 

For more information about ADPropertiesOnly switch, see Get-OwaVirtualDirectory.

Support KB 2896472:

https://support.microsoft.com/en-us/kb/2896472