<# .Synopsis A script to list certain DNS to IP Address lookups in a Skype for Business deployment. It uses the Resolve-DnsName Cmdlet to perform nslookup on specified DNS servers to check for both configured FQDN's but also some best practice FQDN's .DESCRIPTION "Get-DnsAndIP.ps1" is a script to get a overview over deployed DNS records in a Skype for Business deployment. The script is made up of to main "sections". The first section, will look for configured pools, servers and service URLS, and perform lookups on those names The second part will look for a set of "Best Practice" FQDN's associated with client or federation functionallity. These are the initial services the script will perform lookups on: - Configured Pools - Configured Servers - SIMPLE URLS deployed Internally - SIMPLE URLS deployed Externally - Internal web URL - External web URL - Edge Service FQDNs - WacServer URL deployed Internally - WacServer URL deployed Externally - LyncdiscoverInternal - Internal Lyncdiscover for Mobility - External Lyncdiscover - Internal _sip._Tls resource records - External _sip._Tls resource records - Sip Federation resource records - Sip record internally - Sip record Externally - XMPP resource records It is important to know this script does not verify your configuration, nor does it correct the configuration. It simply gather all that is configured, to make it easier to detect DNS errors. There are three different scenarios of the outcome of this script: - An expected record is found. It will then be stored in the table and written to the report (NB: just because a record is found, doesn't mean it's right) - An "expected" record is not found. It will then be stored in the table and written to the report, but marked as "Failed" or "Investigate". (NB: A Failed record doesn't mean it's wrong. It might have been left out on purpose). - An unexpected record is found. It will then be stored in the table and written to the report, but marked as "Investigate". Read the Notes (get-help .\Get-DnsAndIP.ps1 -full) for a version history, and a list of general warnings --------------------------------------------------- Created by Lasse Nordvik Wedø - All rights reserved --------------------------------------------------- .Notes - This script is for both Enterprise and Standard Edition Server. - This script has only been tested on SfB server - The script has only been run and testet on single site/pool installations, so use caution when trying to do otherwise. - The script should be able to run without any modification. - The script must be run on a server where Lync PS is available. - I highly recommend you test the script in your Lab, before running in your production environment - The script supports IPv6 - The script will try to autodiscover internalDNS if none set - The script will use Google 8.8.8.8 as externalDNS if not set V 1.0 - June 2015 - INITIAL RELEASE, read description for details V 1.1 - April 2016 - Added IPv6 to the search and report - Added autodisovery of internalDNS .Link Twitter: http://www.twitter.com/lawedo Website: http://uc.lawedo.net Facebook: http://www.facebook.com/Tech.at.work LinkedIn: http://www.linkedin.com/in/lawedo Current Verision: https://gallery.technet.microsoft.com/Get-DnsAndIPPS1-List-your-a4689878 .EXAMPLE .\Get-DnsAndIP.ps1 -InternalDNS '10.10.10.10' Will gather the information, store the report to c:\UCDoc and show a summary of records to investigate in the shell .EXAMPLE .\Get-DnsAndIP.ps1 -InternalDNS '10.10.10.10' -showReport Will gather the information, store the report to c:\UCDoc and show a summary of records to investigate in the shell A Browser should open with the report, when ready .EXAMPLE .\Get-DnsAndIP.ps1 -InternalDNS '10.10.10.10' -ExternalDNS '4.4.4.4' Will gather the information, store the report to c:\UCDoc and show a summary of records to investigate in the shell .Parameter InternalDNS This is a non-mandatory parameter (String) used to identify the Internal DNS Server to do the lookups on. .Parameter ExternalDNS This is a non-mandatory parameter (String) used to identify the External DNS Server to do the lookups on. If non is provided, the script will try to use 8.8.8.8 .Parameter Path This is a non-mandatory parameter (String) used to identify the path of the output report If non is provided, the script will use c:\UCDoc .Parameter showReport This is a non-mandatory switch used to invoke the report file after completion. Launching the HTM file in the default browser .Parameter addIPv6 This is a non-mandatory switch used to add ipv6 addresses to the search and display #> param( [Parameter(Mandatory=$false)] [string]$InternalDNS = "NOTSET", [string]$ExternalDNS = '8.8.8.8', [string]$Path = "C:\UCDoc", [switch]$showReport, [switch]$addIPv6 ) #region Functions function HTML-Header{ [CmdletBinding(SupportsShouldProcess=$True)] param ( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]$Title ) $HTMLheader = @" $Title "@ $HTMLheader } function HTML-End{ $HTMLend = @" "@ $HTMLend } function get-pools { [CmdletBinding(SupportsShouldProcess=$True)] param( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]$CollectionPool ) $LocalServer = Get-WmiObject -Class Win32_ComputerSystem $fqdnLocalServer = “{0}.{1}” -f $LocalServer.Name.ToLower(), $LocalServer.Domain.ToLower() $myCsServices = @(Get-CsService | Where-Object {$_.version -ge 5}) $myCsPools =@() foreach ($service in $myCsServices){ if ($CollectionPool -icontains $service.role) { $myCsPools += $service.PoolFqdn.ToLower() } } $myCsPools = $myCsPools | select -Unique $secondCsPools = @() foreach ($pool in $myCsPools){ if($pool -match '(\d*)\b(.)(\d*)\b(.)(\d*)\b(.)(\d*)'){ Write-Host $pool "is an ipaddress. Can't use value" -ForegroundColor DarkRed } Elseif($pool -imatch '\b(.)'){ $secondCsPools += $pool } Else {Write-Host $pool "is not a FQDN. Can't use value"} } $secondCsPools } function get-machine { [CmdletBinding(SupportsShouldProcess=$True)] param ( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]$CollectionPuter ) $myCsComputers = @() foreach ($pool in $CollectionPuter){ $poolComp = get-cspool -Identity $pool | Select-Object computers $poolComps = $poolComp.computers.split(",") $poolComps = $poolComps.ToLower() $myCsComputers +=$poolComps } $myCsComputers } Function create-Table { New-Object psobject -Property @{Idenity = '';RecordType = '';IpAddress = '';Location = '';Status = '';Function = '';} } Function add-table{ Param( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [string]$poolNameToTable, [string]$TypeToTable, [string]$IpToTable, [string]$LocationToTable, [string]$Critical, [string]$Function ) $OurList = @() $addObject = create-Table $addObject.Idenity = $poolNameToTable $addObject.RecordType = $TypeToTable $addObject.IpAddress = $IpToTable $addObject.Location = $LocationToTable $addObject.Status = $Critical $addObject.Function = $Function $OurList += $addObject Write-Output $OurList } Function get-DNSrecords{ [CmdletBinding(SupportsShouldProcess=$True)] param ( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [string]$NameToLookup, [Parameter(Mandatory=$false,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [string]$TypeToLookup = "A", [string]$ServerToLookup ) $finalIP = Resolve-DnsName -Name $NameToLookup -Type $TypeToLookup -Server $ServerToLookup -ErrorAction SilentlyContinue Write-Output $finalIP } Function List-themAll { [CmdletBinding(SupportsShouldProcess=$True)] param( [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] $Collection, [Parameter(Mandatory=$false,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)] [String]$type, [switch]$Internal, [switch]$External ) $writeOut = @() $entryToAdd = $null foreach ($x in $Collection) { if ($Internal.IsPresent){ if ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $finalIP = get-DNSrecords -NameToLookup $x -TypeToLookup 'SRV' -ServerToLookup $InternalDNS } Else { $finalIP = get-DNSrecords -NameToLookup $x -TypeToLookup 'A' -ServerToLookup $InternalDNS if ($addIPv6.IsPresent){ $finalIPAAAA = get-DNSrecords -NameToLookup $x -TypeToLookup 'AAAA' -ServerToLookup $InternalDNS } } } Elseif ($External.IsPresent){ if ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $finalIP = get-DNSrecords -NameToLookup $x -TypeToLookup 'SRV' -ServerToLookup $ExternalDNS } Else { $finalIP = get-DNSrecords -NameToLookup $x -TypeToLookup 'A' -ServerToLookup $ExternalDNS if ($addIPv6.IsPresent){ $finalIPAAAA = get-DNSrecords -NameToLookup $x -TypeToLookup 'AAAA' -ServerToLookup $ExternalDNS } } } Else {Write-host "No valid switch internal or external given for $x" } if ($finalIP -eq $null){ if ($Internal.IsPresent){ if ($type -eq "Pool" -or $type -eq "Server" -or $type -eq "simpleURL" -or $type -eq "InternalWebFQDN" -or $type -eq "LyncDiscoverInternal" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'A' -IpToTable 'Missing' -LocationToTable 'Internal' -Critical 'Failed' -Function $type } elseif ($type -eq "ExternalWebFQDN" -or $type -eq "LyncDiscover" -or $type -eq "SIP"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'A' -IpToTable 'Missing' -LocationToTable 'Internal' -Critical 'Investigate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'A' -IpToTable 'Missing' -LocationToTable 'Internal' -Critical 'Investigate' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value ' ' $entryToAdd | Add-Member -MemberType NoteProperty -Name 'Port' -Value $($why.Port) } else {} } if ($External.IsPresent){ if ($type -eq "Pool" -or $type -eq "simpleURL" -or $type -eq "ExternalWebFQDN" -or $type -eq "LyncDiscover" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'A' -IpToTable 'Missing' -LocationToTable 'External' -Critical 'Failed' -Function $type } elseif ($type -eq "SIP"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'A' -IpToTable 'Missing' -LocationToTable 'External' -Critical 'Investigate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'SRV' -IpToTable 'Missing' -LocationToTable 'External' -Critical 'Investigate' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value ' ' $entryToAdd | Add-Member -MemberType NoteProperty -Name 'Port' -Value ' ' } } $writeOut += $entryToAdd } if ($finalIPAAAA -eq $null -and $addIPv6.IsPresent){ if ($Internal.IsPresent){ if ($type -eq "Pool" -or $type -eq "Server" -or $type -eq "simpleURL" -or $type -eq "InternalWebFQDN" -or $type -eq "LyncDiscoverInternal" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'AAAA' -IpToTable 'Missing' -LocationToTable 'Internal' -Critical 'Failed' -Function $type } elseif ($type -eq "ExternalWebFQDN" -or $type -eq "LyncDiscover" -or $type -eq "SIP"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'AAAA' -IpToTable 'Missing' -LocationToTable 'Internal' -Critical 'Investigate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'AAAA' -IpToTable 'Missing' -LocationToTable 'Internal' -Critical 'Investigate' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value ' ' $entryToAdd | Add-Member -MemberType NoteProperty -Name 'Port' -Value $($why.Port) } else {} } if ($External.IsPresent){ if ($type -eq "Pool" -or $type -eq "simpleURL" -or $type -eq "ExternalWebFQDN" -or $type -eq "LyncDiscover" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'AAAA' -IpToTable 'Missing' -LocationToTable 'External' -Critical 'Failed' -Function $type } elseif ($type -eq "SIP"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'AAAA' -IpToTable 'Missing' -LocationToTable 'External' -Critical 'Investigate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($x) -TypeToTable 'SRV' -IpToTable 'Missing' -LocationToTable 'External' -Critical 'Investigate' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value ' ' $entryToAdd | Add-Member -MemberType NoteProperty -Name 'Port' -Value ' ' } } $writeOut += $entryToAdd } Else { foreach ($why in $finalIP){ if ($Internal.IsPresent){ if ($type -eq "Pool" -or $type -eq "Server" -or $type -eq "simpleURL" -or $type -eq "InternalWebFQDN" -or $type -eq "LyncDiscoverInternal" -or $type -eq "LyncDiscover" -or $type -eq "SIP" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'Internal' -Critical ' ' -Function $type } Elseif ($type -eq "ExternalWebFQDN"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical 'Investegate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical ' ' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value $($why.NameTarget) $entryToAdd|Add-Member -MemberType NoteProperty -Name 'Port' -Value $($why.Port) } Else {} } if ($External.IsPresent){ if ($type -eq "Pool" -or $type -eq "simpleURL" -or $type -eq "ExternalWebFQDN" -or $type -eq "LyncDiscover" -or $type -eq "SIP" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical ' ' -Function $type } Elseif ($type -eq "InternalWebFQDN"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical 'Investegate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical ' ' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value $($why.NameTarget) $entryToAdd|Add-Member -MemberType NoteProperty -Name 'Port' -Value $($why.Port) } Else {} } $writeOut += $entryToAdd } foreach ($why in $finalIPAAAA){ if ($Internal.IsPresent){ if ($type -eq "Pool" -or $type -eq "Server" -or $type -eq "simpleURL" -or $type -eq "InternalWebFQDN" -or $type -eq "LyncDiscoverInternal" -or $type -eq "LyncDiscover" -or $type -eq "SIP" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'Internal' -Critical ' ' -Function $type } Elseif ($type -eq "ExternalWebFQDN"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical 'Investegate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical ' ' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value $($why.NameTarget) $entryToAdd|Add-Member -MemberType NoteProperty -Name 'Port' -Value $($why.Port) } Else {} } if ($External.IsPresent){ if ($type -eq "Pool" -or $type -eq "simpleURL" -or $type -eq "ExternalWebFQDN" -or $type -eq "LyncDiscover" -or $type -eq "SIP" -or $type -eq "EdgeService" -or $type -eq "WacURL"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical ' ' -Function $type } Elseif ($type -eq "InternalWebFQDN"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical 'Investegate' -Function $type } elseif ($type -eq "SIP-TLS" -or $type -eq "XMPP" -or $type -eq "SIP-Fed"){ $entryToAdd = add-table -poolNameToTable $($why.Name) -TypeToTable $($why.Type) -IpToTable $($why.IPAddress) -LocationToTable 'External' -Critical ' ' -Function $type $entryToAdd | Add-Member -MemberType NoteProperty -Name 'DNS A Rec' -Value $($why.NameTarget) $entryToAdd|Add-Member -MemberType NoteProperty -Name 'Port' -Value $($why.Port) } Else {} } $writeOut += $entryToAdd } } } Write-Output $writeOut } #endregion #region preperations clear-host $filepath = $Path + "\" New-Item $filepath -type directory -force |Out-Null $fileName = $filepath + "DNS_and_IP_Lookup.htm" HTML-Header "DNS and IP List" | Out-File $fileName $Progress = 1 $FailedLookupCollection = @() $PoolOutput = @() #Pools $ServerOutput = @() #Servers $SimpleURLOutputInt = @() #internal SIMPLE URLS $SimpleURLOutputExt = @() #External SIMPLE URLS $InternalWebOutput = @() #Internal web URL $ExternalWebOutput = @() #External web URL $EdgeServicesOutput = @() #Edge Service FQDNs $LyncdiscoverInternalOutput = @() #LyncdiscoverInternal $LyncdiscoverIntOutput = @() #Internal Lyncdiscover for Mobility $LyncdiscoverExtOutput = @() #External Lyncdiscover $SipTlsIntOutput = @() #Internal _sip._Tls recs $SipTlsExtOutput = @() #External _sip._Tls recs $SipFederationOutput = @() #Sip Federation recs $myOwasServerOutputInt = @() #WacServer recs Internal $myOwasServerOutputExt = @() #WacServer recs External $sipArecInt = @() #Sip record internally $sipArecExt = @() #Sip record Externally $xmppFederationOutput = @() #XMPP SRV Records #endregion #region Runscript if ($InternalDNS -eq "NOTSET"){ $IntDns = Get-NetIPConfiguration | Where-Object {$_.IPv4DefaultGateway -ne $null} | Select-Object DNSServer $IntDns = $IntDns.DNSServer $IntDns = $IntDns | sort-Object AddressFamily if ($addIPv6.IsPresent){ $IntDns = $IntDns[1]} else {$IntDns = $IntDns[0]} $IntDns = $IntDns.ServerAddresses $IntDns = $IntDns[0] $InternalDNS = $IntDns } Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering CsPool information" -percentComplete ($Progress / 13*100) $ipCollection = ($coll = Get-CsService | select role) $ipCollection = $ipCollection.role $ipQueryPool = get-pools $ipCollection $PoolOutput = List-themAll -Collection $ipQueryPool -type 'Pool' -Internal $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering CsServer information" -percentComplete ($Progress / 13*100) foreach ($ippool in $ipQueryPool) { $ipQueryComputers = get-machine $ippool $ServerOutputx = List-themAll -Collection $ipQueryComputers -type 'Server' -Internal $ServerOutput += $ServerOutputx } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering SimpleURL information" -percentComplete ($Progress / 13*100) $SimpleURLs = Get-CsSimpleUrlConfiguration | Select-Object simpleurl -ExpandProperty Simpleurl|Select-Object Activeurl foreach ($url in $SimpleURLs){ $myFQDNfromUrl = $url.Activeurl -split "/" $hostLookup = $myFQDNfromUrl[2] $SimpleURLOutputIntX = List-themAll -Collection $hostLookup -type 'simpleURL' -Internal $SimpleURLOutputInt += $SimpleURLOutputIntX $SimpleURLOutputExtX = List-themAll -Collection $hostLookup -type 'simpleURL' -External $SimpleURLOutputExt += $SimpleURLOutputExtX } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering Web Service URL information" -percentComplete ($Progress / 13*100) $myPoolservURL = Get-CsService -WebServer | Select-Object ExternalFqdn,InternalFqdn $externalLookup = $myPoolservURL.ExternalFqdn $internalLookup = $myPoolservURL.InternalFqdn if ($externalLookup -ne $null){ foreach ($addr in $externalLookup){ $ExternalWebOutputX = List-themAll -Collection $addr -type 'ExternalWebFQDN' -Internal $ExternalWebOutput += $ExternalWebOutputX $ExternalWebOutputX = List-themAll -Collection $addr -type 'ExternalWebFQDN' -External $ExternalWebOutput += $ExternalWebOutputX } } if ($internalLookup -ne $null){ foreach ($addr in $internalLookup){ $InternalWebOutputX = List-themAll -Collection $addr -type 'InternalWebFQDN' -Internal $InternalWebOutput += $InternalWebOutputX $InternalWebOutputX = List-themAll -Collection $addr -type 'InternalWebFQDN' -External $InternalWebOutput += $InternalWebOutputX } } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering Edge Service FQDN information" -percentComplete ($Progress / 13*100) $myEdgeService = get-csservice -EdgeServer | Select-Object AccessEdgeExternalFqdn,DataEdgeExternalFqdn,AVEdgeExternalFqdn $myEdgeServiceAccess = $myEdgeService.AccessEdgeExternalFqdn $myEdgeServiceData = $myEdgeService.DataEdgeExternalFqdn $myEdgeServiceAV = $myEdgeService.AVEdgeExternalFqdn if ($myEdgeServiceAccess -ne $null){ foreach ($addr in $myEdgeServiceAccess){ $EdgeServicesOutputX = List-themAll -Collection $addr -type 'EdgeService' -External $EdgeServicesOutput += $EdgeServicesOutputX } } if ($myEdgeServiceData -ne $null){ foreach ($addr in $myEdgeServiceData){ $EdgeServicesOutputX = List-themAll -Collection $addr -type 'EdgeService' -External $EdgeServicesOutput += $EdgeServicesOutputX } } if ($myEdgeServiceAV -ne $null){ foreach ($addr in $myEdgeServiceAV){ $EdgeServicesOutputX = List-themAll -Collection $addr -type 'EdgeService' -External $EdgeServicesOutput += $EdgeServicesOutputX } } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering WacServer information" -percentComplete ($Progress / 13*100) $myOwasServer = Get-CsService -WacServer | Select-Object PoolFqdn $myOwasServer = $myOwasServer.PoolFqdn if ($myOwasServer -ne $null){ foreach ($addr in $myOwasServer){ $myOwasServerOutputX = List-themAll -Collection $addr -type 'WacURL' -Internal $myOwasServerOutputInt += $myOwasServerOutputX $myOwasServerOutputX = List-themAll -Collection $addr -type 'WacURL' -External $myOwasServerOutputExt += $myOwasServerOutputX } } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering Other relevant FQDN information" -percentComplete ($Progress / 13*100) $mySipDomains = Get-CsSipDomain | Select-Object Identity $mySipDomains = $mySipDomains.Identity $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering Lyncdiscoverinternal information" -percentComplete ($Progress / 13*100) foreach ($dom in $mySipDomains){ $constructURL1 = "lyncdiscoverinternal." + $dom $LyncdiscoverInternalOutputx = List-themAll -Collection $constructURL1 -type 'LyncDiscoverInternal' -Internal $LyncdiscoverInternalOutput += $LyncdiscoverInternalOutputx } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering SIP.Domain information" -percentComplete ($Progress / 13*100) foreach ($dom in $mySipDomains){ $constructURL1 = "sip." + $dom $sipArecIntx = List-themAll -Collection $constructURL1 -type 'SIP' -Internal $sipArecInt += $sipArecIntx $sipArecExtx = List-themAll -Collection $constructURL1 -type 'SIP' -External $sipArecExt += $sipArecExtx } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering Lyncdiscover information" -percentComplete ($Progress / 13*100) foreach ($dom in $mySipDomains){ $constructURL1 = "lyncdiscover." + $dom $LyncdiscoverIntOutputX = List-themAll -Collection $constructURL1 -type 'LyncDiscover' -Internal $LyncdiscoverIntOutput += $LyncdiscoverIntOutputX $LyncdiscoverExtOutputX = List-themAll -Collection $constructURL1 -type 'LyncDiscover' -External $LyncdiscoverExtOutput += $LyncdiscoverExtOutputX } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering _sip._tls information" -percentComplete ($Progress / 13*100) $constructURL1 = " " foreach ($dom in $mySipDomains){ $constructURL1 = "_sip._tls." + $dom $SipTlsIntOutputX = List-themAll -Collection $constructURL1 -type 'SIP-TLS' -Internal $SipTlsIntOutput += $SipTlsIntOutputX $SipTlsExtOutputX = List-themAll -Collection $constructURL1 -type 'SIP-TLS' -External $SipTlsExtOutput += $SipTlsExtOutputX } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering _sipfederationtls._tcp information" -percentComplete ($Progress / 13*100) foreach ($dom in $mySipDomains){ $constructURL1 = "_sipfederationtls._tcp." + $dom $SipFederationOutputX = List-themAll -Collection $constructURL1 -type 'SIP-Fed' -External $SipFederationOutput += $SipFederationOutputX } $Progress ++ Write-Progress -Activity "Gather DNS and IP addresses" -status "Gathering _xmpp-server._tcp information" -percentComplete ($Progress / 13*100) foreach ($dom in $mySipDomains){ $constructURL1 = "_xmpp-server._tcp." + $dom $xmppFederationOutputX = List-themAll -Collection $constructURL1 -type 'XMPP' -External $xmppFederationOutput += $xmppFederationOutputX } $Progress ++ #endregion #region Write output Write-Progress -Activity "Gather DNS and IP addresses" -status "Creating Output" -percentComplete 100 "

Pool DNS Info

" | Out-File $fileName -append $PoolOutput |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

Server DNS Info

" | Out-File $fileName -append $ServerOutput |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

Simple URL's Internally

" | Out-File $fileName -append $SimpleURLOutputInt |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

Simple URL's Externally

" | Out-File $fileName -append $SimpleURLOutputExt |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

External WebURLs published

" | Out-File $fileName -append $ExternalWebOutput |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

Internal WebURLs published

" | Out-File $fileName -append $InternalWebOutput |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

Edge Service FQDNs published

" | Out-File $fileName -append $EdgeServicesOutput |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

WacServer published Internally

" | Out-File $fileName -append $myOwasServerOutputInt |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

WacServer published Externally

" | Out-File $fileName -append $myOwasServerOutputExt |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

Lyncdiscoverinternal published

" | Out-File $fileName -append $LyncdiscoverInternalOutput |Sort-Object IpAddress|get-unique -asstring | ConvertTo-HTML -fragment | Out-File $fileName -append "

Lyncdiscover published Externally

" | Out-File $fileName -append $LyncdiscoverExtOutput |Sort-Object IpAddress|get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append "

Lyncdiscover published Internally

" | Out-File $fileName -append $LyncdiscoverIntOutput |Sort-Object IpAddress|get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append "

SIP published Externally

" | Out-File $fileName -append $sipArecExt |Sort-Object IpAddress|get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append "

SIP published Internally

" | Out-File $fileName -append $sipArecInt |Sort-Object IpAddress|get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append "

Internal TLS SRV Records

" | Out-File $fileName -append $SipTlsIntOutput|get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append "

External TLS SRV Records

" | Out-File $fileName -append $SipTlsExtOutput|get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append "

External SIP Federation Records

" | Out-File $fileName -append $SipFederationOutput |get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append "

External XMPP Federation Records

" | Out-File $fileName -append $xmppFederationOutput |get-unique -asstring |ConvertTo-HTML -fragment | Out-File $fileName -append $AllTogether = $PoolOutput + $ServerOutput + $SimpleURLOutputInt + $SimpleURLOutputExt + $InternalWebOutput + $ExternalWebOutput + $LyncdiscoverInternalOutput + $LyncdiscoverIntOutput + $LyncdiscoverExtOutput + $EdgeServicesOutput + $myOwasServerOutputInt + $myOwasServerOutputExt + $sipArecInt + $sipArecExt $FailedLookupCollectionext = $AllTogether| Where-Object {$_.Status -ne ' ' -and $_.Location -eq "External"} $FailedLookupCollectionint = $AllTogether| Where-Object {$_.Status -ne ' ' -and $_.Location -eq "Internal"} $AllTogetherSRV = $SipTlsIntOutput + $SipTlsExtOutput + $SipFederationOutput + $xmppFederationOutput $FailedLookupCollectionextSRV = $AllTogetherSRV| Where-Object {$_.Status -ne ' ' -and $_.Location -eq "External"} $FailedLookupCollectionintSRV = $AllTogetherSRV| Where-Object {$_.Status -ne ' ' -and $_.Location -eq "Internal"} if ($FailedLookupCollectionext -ne $null){ Write-Host "A list of failed A lookups externally. Not all are critical, but please investegate" -ForegroundColor Green $FailedLookupCollectionext | Sort-Object Status|get-unique -asstring |ft -AutoSize } if ($FailedLookupCollectionint -ne $null){ Write-Host "A list of failed A lookups internally. Not all are critical, but please investegate" -ForegroundColor Green $FailedLookupCollectionint | Sort-Object Status|get-unique -asstring |ft -AutoSize } if ($FailedLookupCollectionextSRV -ne $null){ Write-Host "A list of failed SRV lookups externally. Not all are critical, but please investegate" -ForegroundColor Green $FailedLookupCollectionextSRV | Sort-Object Status|get-unique -asstring |ft -AutoSize } if ($FailedLookupCollectionintSRV -ne $null){ Write-Host "A list of failed SRV lookups internally. Not all are critical, but please investegate" -ForegroundColor Green $FailedLookupCollectionintSRV | Sort-Object Status|get-unique -asstring |ft -AutoSize } HTML-End | Out-File $fileName -Append if (!($showReport.IsPresent)){ Write-Host "A report of all the found records can be found in " -ForegroundColor Yellow -NoNewline Write-Host $fileName } if ($showReport.IsPresent){ Invoke-Item $fileName } #endregion