Get all Exchange VirtualDirectory Urls

Does anyone have a quick PowerShell script to gather the Internal and External Url's from a large exchange 2010-2016 environment?

Autodiscover Service, ECP, EWS, ActiveSync, OWA, OAB, PowerShell etc?

Output to a CSV for example?
Christian HansAsked:
Who is Participating?
 
ITguy565Commented:
Try this and let me know if this is what you are looking for :

 $virtds = "ECP,OWA,OAB,WebServices,Activesync"  
 $array = $virtds.split(",")  
 foreach ($i in $array) {  
 $j = "Get-"+$i+"VirtualDirectory"+" | fl name,server,internalurl,externalurl"  
 iex $j   
 }  

Open in new window


reference : http://www.siyavaya.com/2013/04/get-internal-and-external-urls-for-all.html
0
 
MichelangeloConsultantCommented:
https://vanhybrid.com/2016/09/12/exchange-virtual-directory-html-report/

Complete report on exchange virtualdirectory urls
0
 
Aaron GuilmetteTechnology Solutions ProfessionalCommented:
This should do what you want.  Servers can have multiple web instances, so you probably need to treat each of them as an array.

[array]$Servers = Get-ExchangeServer
$ServersTotal = $Servers.count
$i = 1
foreach ($server in $Servers)
{
	Write-Host "Enumerating virtual directories for $($server)... [$($i) / $($ServersTotal)]"
	[array]$virtualdirectories = @('ecp','ews','autodiscover','owa','oab','powershell')
	[array]$ecp = Get-EcpVirtualDirectory -server $server
	[array]$ews = Get-WebServicesVirtualDirectory -server $server
	[array]$autodiscover = Get-AutoDiscoverVirtualDirectory -server $server
	[array]$owa = Get-OwaVirtualDirectory -server $server
	[array]$oab = Get-OabVirtualDirectory -server $server
	[array]$activesync = Get-ActiveSyncVirtualDirectory -server $server
	[array]$powershell = Get-PowerShellVirtualDirectory -server $server
	foreach ($obj in $ecp)
	{
		# Exchange Control Panel / ECP
		Write-Host "     Processing ECP."
		foreach ($obj in $ecp)
		{
			[object]$Output = New-Object -TypeName PSObject
			$Output | Add-Member -Type NoteProperty -Name Server -Value $server.fqdn
			$Output | Add-Member -Type NoteProperty -Name Name -Value $obj.name
			$Output | Add-Member -Type NoteProperty -Name Id -Value $obj.Id
			$Output | Add-Member -Type NoteProperty -Name InternalUrl -Value $obj.InternalUrl
			$Output | Add-Member -Type NoteProperty -Name ExternalUrl -Value $obj.ExternalUrl
			$Output | Export-Csv .\ExchangeData.csv -Append
		} # End ECP
		
		# Exchange Web Services / EWS
		Write-Host "     Processing EWS."
		foreach ($obj in $ews)
		{
			[object]$Output = New-Object -TypeName PSObject
			$Output | Add-Member -Type NoteProperty -Name Server -Value $server.fqdn
			$Output | Add-Member -Type NoteProperty -Name Name -Value $obj.name
			$Output | Add-Member -Type NoteProperty -Name Id -Value $obj.Id
			$Output | Add-Member -Type NoteProperty -Name InternalUrl -Value $obj.InternalUrl
			$Output | Add-Member -Type NoteProperty -Name ExternalUrl -Value $obj.ExternalUrl
			$Output | Add-Member -Type NoteProperty -Name InternalNLBBypassUrl -Value $obj.InternalNLBBypassUrl
			$Output | Export-Csv .\ExchangeData.csv -Append
		} # End EWS
		
		# Autodiscover Virtual Directory
		Write-Host "     Processing Autodiscover."
		foreach ($obj in $autodiscover)
		{
			[object]$Output = New-Object -TypeName PSObject
			$Output | Add-Member -Type NoteProperty -Name Server -Value $server.fqdn
			$Output | Add-Member -Type NoteProperty -Name Name -Value $obj.name
			$Output | Add-Member -Type NoteProperty -Name Id -Value $obj.Id
			$Output | Add-Member -Type NoteProperty -Name InternalUrl -Value $obj.InternalUrl
			$Output | Add-Member -Type NoteProperty -Name ExternalUrl -Value $obj.ExternalUrl
			$Output | Export-Csv .\ExchangeData.csv -Append
		} # End autodiscover
		
		# Outlook Web App / OWA
		Write-Host "     Processing OWA."
		foreach ($obj in $owa)
		{
			[object]$Output = New-Object -TypeName PSObject
			$Output | Add-Member -Type NoteProperty -Name Server -Value $server.fqdn
			$Output | Add-Member -Type NoteProperty -Name Name -Value $obj.name
			$Output | Add-Member -Type NoteProperty -Name Id -Value $obj.Id
			$Output | Add-Member -Type NoteProperty -Name InternalUrl -Value $obj.InternalUrl
			$Output | Add-Member -Type NoteProperty -Name ExternalUrl -Value $obj.ExternalUrl
			$Output | Add-Member -Type NoteProperty -Name InternalNLBBypassUrl -Value $obj.InternalNLBBypassUrl
			$Output | Add-Member -Type NoteProperty -Name FailbackUrl -Value $obj.FailbackUrl
			$Output | Add-Member -Type NoteProperty -Name Exchange2003Url -Value $obj.Exchange2003Url
			$Output | Export-Csv .\ExchangeData.csv -Append
		} # End OWA
		
		# Offline Address Book
		Write-Host "     Processing OAB."
		foreach ($obj in $oab)
		{
			[object]$Output = New-Object -TypeName PSObject
			$Output | Add-Member -Type NoteProperty -Name Server -Value $server.fqdn
			$Output | Add-Member -Type NoteProperty -Name Name -Value $obj.name
			$Output | Add-Member -Type NoteProperty -Name Id -Value $obj.Id
			$Output | Add-Member -Type NoteProperty -Name InternalUrl -Value $obj.InternalUrl
			$Output | Add-Member -Type NoteProperty -Name ExternalUrl -Value $obj.ExternalUrl
			$Output | Export-Csv .\ExchangeData.csv -Append
		} # End OWAB
		
		# ActiveSync
		Write-Host "     Processing ActiveSync."
		foreach ($obj in $ActiveSync)
		{
			[object]$Output = New-Object -TypeName PSObject
			$Output | Add-Member -Type NoteProperty -Name Server -Value $server.fqdn
			$Output | Add-Member -Type NoteProperty -Name Name -Value $obj.name
			$Output | Add-Member -Type NoteProperty -Name Id -Value $obj.Id
			$Output | Add-Member -Type NoteProperty -Name InternalUrl -Value $obj.InternalUrl
			$Output | Add-Member -Type NoteProperty -Name ExternalUrl -Value $obj.ExternalUrl
			$Output | Export-Csv .\ExchangeData.csv -Append
		} # Ennd ActiveSync
		
		# PowerShell
		Write-Host "     Processing PowerShell."
		foreach ($obj in $PowerShell)
		{
			[object]$Output = New-Object -TypeName PSObject
			$Output | Add-Member -Type NoteProperty -Name Server -Value $server.fqdn
			$Output | Add-Member -Type NoteProperty -Name Name -Value $obj.name
			$Output | Add-Member -Type NoteProperty -Name Id -Value $obj.Id
			$Output | Add-Member -Type NoteProperty -Name InternalUrl -Value $obj.InternalUrl
			$Output | Add-Member -Type NoteProperty -Name ExternalUrl -Value $obj.ExternalUrl
			$Output | Export-Csv .\ExchangeData.csv -Append
		} # End PowerShell
	} # End Virtual Directory Processing
	$i++
}

Open in new window

0
All Courses

From novice to tech pro — start learning today.