$ports = import-csv "C:\Docs\работа\SIT\MTS Cloud\AzureStack\3.Support\azs_ports.csv" -delimiter ";"
foreach($port in $ports) {
$client = new-object System.Net.Sockets.TcpClient
try {
$client.Connect($port.ip, $port.port) | out-host
if ($client.Connected) {
Write-host $port.ip $port.port " - OK" -ForegroundColor Green
}
$client.Close()
}
catch {
Write-host $port.ip $port.port " - FAIL" -ForegroundColor Red
Write-Host $_ -ForegroundColor Red
}
}
foreach($port in $ports) {
$client = new-object System.Net.Sockets.TcpClient
try {
$client.Connect($port.ip, $port.port) | out-host
if ($client.Connected) {
Write-host $port.ip $port.port " - OK" -ForegroundColor Green
}
$client.Close()
}
catch {
Write-host $port.ip $port.port " - FAIL" -ForegroundColor Red
Write-Host $_ -ForegroundColor Red
}
}
Комментариев нет:
Отправить комментарий