Skip to content

Instantly share code, notes, and snippets.

@jwmoss
Last active June 19, 2023 15:47
Show Gist options
  • Save jwmoss/1277a93024bb08f14aea87c4d488e709 to your computer and use it in GitHub Desktop.
Save jwmoss/1277a93024bb08f14aea87c4d488e709 to your computer and use it in GitHub Desktop.
adcheck
## Get all DCs
$ports = @(
"135", ## TCP
"389", ## TCP/UDP
"636", ## TCP
"3268", ## TCP
"3269", ## TCP
"53", ## TCP/UDP
"88", ## TCP/UDP
"445" ## TCP
)
$Servers = @()
Foreach ($thing in $Servers) {
foreach ($p in $ports) {
[PSCustomobject]@{
From = $env:COMPUTERNAME
To = $thing
Port = $p
Result = (Test-NetConnection -ComputerName $thing -Port $p).TcpTestSucceeded
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment