首页 > 代码库 > Powershell实现Telnet Port
Powershell实现Telnet Port
Telnet Port 脚本
1 $servers = get-content D:\ps\ServerIPAddress.TXT 2 $portToCheck = ‘80‘ 3 for($i=1;$i -le 120;$i++) 4 { 5 foreach ($server in $servers) { 6 7 If ( Test-Connection $server -Count 1 -Quiet) { 8 9 try { 10 $null = New-Object System.Net.Sockets.TCPClient -ArgumentList $server,$portToCheck 11 $props = @{ 12 Server = $server 13 PortOpen = ‘Yes‘ 14 Date=get-date 15 } 16 } 17 18 catch { 19 $props = @{ 20 Server = $server 21 PortOpen = ‘No‘ 22 Date=get-date 23 } 24 } 25 } 26 27 Else { 28 29 $props = @{ 30 Server = $server 31 PortOpen = ‘Server did not respond to ping‘ 32 Date=get-date 33 } 34 } 35 36 New-Object PsObject -Property $props | Out-File -Append D:\PS\test-telnet.csv 37 } 38 Start-Sleep -s 10 39 }
Powershell实现Telnet Port
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。