Site icon Sistem Destek Uzmanı

Test-NetConnection Scriptleri : Port Bazlı Kontrol

Belirli Bir Port Aralığına Erişim Testi Script

$DomainControllers = @(
"SRVDC01.domain.local",
"SRVDC02.domain.local"
)
foreach ($DC in $DomainControllers) {
foreach ($Port in 49152..65535) {
$check = Test-NetConnection -ComputerName $DC -Port $Port -WarningAction SilentlyContinue
if ($check.TcpTestSucceeded) {
Write-Host ($DC + " on port " + $Port + ": Connection Successful") -ForegroundColor Green
} else {
Write-Host ($DC + " on port " + $Port + ": Connection Failed") -ForegroundColor Red
}
}
}

Active Directory Portları Erişim Testi Script

$DomainControllers = @{
"SRVDC01.domain.local" = @(53,88,464,3268,3269,389,636,135,137,138,139,445,123,49443)
"SRVDC02.domain.local" = @(53,88,464,3268,3269,389,636,135,137,138,139,445,123,49443)
}
foreach ($DC in $DomainControllers.Keys) {
foreach ($Port in $DomainControllers[$DC]) {
$check = Test-NetConnection -ComputerName $DC -Port $Port -WarningAction SilentlyContinue
if ($check.TcpTestSucceeded) {
Write-Host ($DC + " on port " + $Port + ": Connection Successful") -ForegroundColor Green
} else {
Write-Host ($DC + " on port " + $Port + ": Connection Failed") -ForegroundColor Red
}
}
}

İlgili Portlar Şunlardır:

Exit mobile version