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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.