我需要找出哪些服务器端口正在侦听端口3389.我必须检查2500个服务器,一些在不同的vlans,以确保启用远程桌面。
netstat可以用来检查这个和ip地址范围..或最好是使用powershell命令
新对象system.net.sockets.TCPclientList xsevernamex,3389
nmap非常适合这个:
nmap -v -p 3389 -iL list-of-hosts.txt -oX results.xml
将导致一个XML文件,你可以编程分析,但其他输出选项也存在。
我更喜欢powershell。 让我知道这是否需要任何调整。 input.txt只是一个计算机的列表。
$computers = Import-Csv input.txt -Header "Name" $output = @() $computers | ForEach-Object { $current = "" | Select-Object "Name","RdpOpen" $result = Test-NetConnection $_.Name -CommonTCPPort RDP $current.Name = $_.Name $current.RdpOpen = $result.TcpTestSucceeded $output += $current } $output | Export-Csv output.csv -NoTypeInformation