Friday, 19 April 2013

Get Internal and External URLs for all Exchange Virtual Directories

I've just had to check all the virtual directory URLs for a large Exchange implementation.  Due to the geographical locations of some of the servers the Get-*VirtualDirectory takes a while to execute so a quick script was required:
 $virtds = "ECP,OWA,OAB,WebServices,Activesync"  
 $array = $virtds.split(",")  
 foreach ($i in $array) {  
 $j = "Get-"+$i+"VirtualDirectory"+" | fl name,server,internalurl,externalurl"  
 iex $j   
 }  
The space between the " and | is intentional as you could add -Server in there if you wanted to list all the virtual directories on a particular server.

iex is the alias for Invoke-Expression which I have never found a use for until now.

No comments:

Post a Comment