26 lines
736 B
PowerShell
Executable File
26 lines
736 B
PowerShell
Executable File
# IP ou nom DNS du contrôleur de domaine principal
|
|
$dc = Read-Host "Nom ou IP du controleur de domaine principal"
|
|
|
|
# Liste des ports nécessaires à AD
|
|
$ports = @(
|
|
53, # DNS
|
|
88, # Kerberos
|
|
135, # RPC Endpoint Mapper
|
|
389, # LDAP
|
|
445, # SMB
|
|
3268, # LDAP Global Catalog
|
|
3269, # LDAP GC over SSL
|
|
636, # LDAPS
|
|
9389 # AD Web Services
|
|
)
|
|
|
|
# Fonction de test
|
|
foreach ($port in $ports) {
|
|
$result = Test-NetConnection -ComputerName $dc -Port $port -WarningAction SilentlyContinue
|
|
if ($result.TcpTestSucceeded) {
|
|
Write-Host "Port $port ouvert vers $dc" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "Port $port fermé ou filtré vers $dc" -ForegroundColor Red
|
|
}
|
|
}
|