Salve a todos!
Compartilho com vocês um script em Powershell para testar todas as portas de uma lista de Domain Controllers.
Segue:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Computers= @("server01","server02") | |
$Computers | ForEach-Object {$Computers = $_; | |
$Ports = @(53,88,135,139,389,445,464,636,3268,3269,9389) | |
Write-Host $Computers -ForegroundColor Yellow | |
$Ports | ForEach-Object {$port = $_; if (Test-NetConnection -ComputerName $Computers -Port $port -InformationLevel Quiet -WarningAction SilentlyContinue) | |
{"Port $port is open" } else {"Port $port is closed"} } | |
Write-Host "" | |
} |
server01
Port 53 is open
Port 88 is open
Port 135 is open
Port 139 is open
Port 389 is open
Port 445 is open
Port 464 is open
Port 636 is open
Port 3268 is open
Port 3269 is open
Port 9389 is open
server02
Port 53 is open
Port 88 is open
Port 135 is open
Port 139 is open
Port 389 is open
Port 445 is open
Port 464 is open
Port 636 is open
Port 3268 is open
Port 3269 is open
Port 9389 is open
Até a próxima!
Breno Padovan