@@ -71,7 +71,7 @@ function Measure-NetworkHops {
7171 [string ]
7272 $Server
7373 )
74- Write-Host " Measuring network hops to $Server ..." - ForegroundColor Yellow
74+ Write-Host " Measuring network hops to $Server ..." - NoNewline - ForegroundColor Yellow
7575 $TestResult = Test-NetConnection - ComputerName $Server - TraceRoute - InformationLevel Detailed
7676 $Result = [PSCustomObject ]@ {
7777 Server = $Server
@@ -85,9 +85,24 @@ function Measure-NetworkHops {
8585 $Result
8686}
8787
88- # Example Usage:
88+ # Example Usage: Measure network hops and DNS response time for a list of DNS servers.
8989$DnsServers = @ (' 8.8.8.8' , ' 8.8.4.4' , ' 1.1.1.1' , ' 9.9.9.9' )
9090$DnsServers | ForEach-Object {
9191 Measure-NetworkHops - Server $_
9292 Measure-DnsResponseTime - DnsServer $_ - TargetName ' day3bits.com' | Out-Null
9393}
94+
95+ # Example Usage: Measure network hops and DNS response time for all domain controllers in the current domain.
96+ $TestResults = New-Object System.Collections.Generic.List[PSObject ]
97+ $Servers = Get-ADDomainController - Filter * | Select-Object - ExpandProperty Name
98+ $Servers | ForEach-Object {
99+ $NetworkHops = Measure-NetworkHops - Server $_
100+ $Results = [PSCustomObject ]@ {
101+ Server = $NetworkHops.Server
102+ NetworkHops = $NetworkHops.Hops
103+ PingSucceeded = $NetworkHops.PingSucceeded
104+ PingRoundTripTime = $NetworkHops.PingRoundTripTime
105+ AverageQueryResponseTime = Measure-DnsResponseTime - DnsServer $_ - TargetName ' day3bits.com'
106+ }
107+ $TestResults.Add ($Results ) | Out-Null
108+ }
0 commit comments