Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active September 9, 2021 14:10
Show Gist options
  • Save darrenjrobinson/6255dbf56770f96606608f8de16057d9 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/6255dbf56770f96606608f8de16057d9 to your computer and use it in GitHub Desktop.
Test Port Connectivity required for FIM/MIM Active Directory Management Agent. Associated blogpost https://blog.darrenjrobinson.com/diagnosing-fimmim-kerberos-no-logon-server-error-on-an-active-directory-management-agent/
# Insert Test-Port Function here from https://gallery.technet.microsoft.com/scriptcenter/97119ed6-6fb2-446d-98d8-32d823867131
# UDP Ports to probe
$udpports = @()
$udpports += "464" #Kerberos
$udpports += "3268" #GC
$udpports += "3269" #GC
# TCP Ports to probe
$ports = @()
$ports += "389" #LDAP
$ports += "636" #LDAPS
$ports += "88" #Kerberos
$ports += "464" #Kerberos
$ports += "53" #DNS
$ports += "3268" #GC
$ports += "3269" #GC
$ports += "135" #RPC
# Hosts to probe
$targethosts = @()
$targethosts += "corporateforest.com.au"
$targethosts += "consumerforest.com.au"
$targethosts += "externalforest.com.au"
$summary = $null
# Do it
foreach ($target in $targethosts){
$targetDetails = Test-Netconnection $target -WarningAction SilentlyContinue
$report = @{}
$report.add("Target",$targetDetails.ComputerName)
write-host "Target" $targetDetails.ComputerName
$report.add("Target Address",$targetDetails.RemoteAddress)
write-host "Target Address" $targetDetails.RemoteAddress
foreach ($port in $ports){
$response = Test-Netconnection $target -Port $port -WarningAction SilentlyContinue
$report.add("TCP Port $port",$response.TcpTestSucceeded)
if ($response.TcpTestSucceeded -eq $False){write-host "TCP Port $port",$response.TcpTestSucceeded -foregroundcolor "magenta" -backgroundcolor "yellow"}
if ($response.TcpTestSucceeded -eq $True){write-host "TCP Port $port",$response.TcpTestSucceeded}
}
foreach ($udpport in $udpports){
$udpresponse = Test-Port -computer $target -port $udpport -UDP -WarningVariable $null
$report.add("UDP Port $udpport",$udpresponse.Open)
if ($udpresponse.Open -eq $False){write-host "UDP Port $udpport",$udpresponse.Open -foregroundcolor "magenta" -backgroundcolor "yellow"}
if ($udpresponse.Open -eq $True){write-host "UDP Port $udpport",$udpresponse.Open }
}
$output = $report.GetEnumerator() | Sort Name
#$output
$summary += $output
}
$summary
@manishkungwani
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment