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 }

时间: 2024-11-12 01:54:29

Powershell实现Telnet Port的相关文章

一键安装并启用 telnet服务

1 概述 通过telnet方式连接到其他机器,进行远程操作 本文实现了一键安装,并开启telnet服务. 2 启用服务 默认情况下,telnet连接不能用root账号登陆,需要用普通用户的账号连接 2.1 安装服务包 安装xinted,telnet,telnet-server三个包 2.2 开启xinetd Cent OS 6 service xinetd restart CentOS7 systemctl restart xinetd 2.3 开启telnet 如果以上的telnet已经安装,

centOS上安装Telnet

安装之前了解一下Telnet,在公共网络上用telnet传输数据不安全,建议只在本地网络上使用 Using Telnet in public network(WAN) is very very bad idea. It transmits login data in the clear format. Everything will be sent in plain text. If you still need Telnet, It is highly recommended use it i

Juniper Netsreen 防火墙无法登陆的问题解决

Juniper防火墙无法登陆的问题解决: juniper防火墙不管是内网还是外网,不管是http还是telnet都无法登陆.当遇到这样的问题该如何解决,下面介绍一下解决问题的过程. 由于telnet和http都不能登录,只能通过console线连接设备. 先通过命令"get int"检查接口状态,几个接口的状态都是"U"连接状态,接口的IP都是正常的. SSG140-> get int eth0/0Interface ethernet0/0:descripti

springboot配置文件application.properties

# =================================================================== # COMMON SPRING BOOT PROPERTIES # # This sample file is provided as a guideline. Do NOT copy it in its # entirety to your own application. ^^^ # ===================================

玩转spring boot——properties配置

前言 在以往的java开发中,程序员最怕大量的配置,是因为配置一多就不好统一管理,经常出现找不到配置的情况.而项目中,从开发测试环境到生产环境,往往需要切换不同的配置,如测试数据库连接换成生产数据库连接,若有一处配错或遗漏,就会带来不可挽回的损失.正因为这样,spring boot给出了非常理想的解决方案——application.properties.见application-properties的官方文档:http://docs.spring.io/spring-boot/docs/curr

spring-boot的配置

application.propertis比yaml文件要好看得多 # =================================================================== # COMMON SPRING BOOT PROPERTIES # # This sample file is provided as a guideline. Do NOT copy it in its # entirety to your own application. ^^^ # =

spring boot项目配置文件集合

# =================================================================== # COMMON SPRING BOOT PROPERTIES # # This sample file is provided as a guideline. Do NOT copy it in its # entirety to your own application. ^^^ # ===================================

RHEL5.4 openssh升级至OpenSSH_7.4p1版本-shell处理

客户30台RHEL5.4系统的openssh需要升级到OpenSSH_7.4p1版本 #cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.4 (Tikanga) # uname -r 2.6.18-164.el5PAE # uname -m i686 由于防止远程连接中断,需要开启telnet服务,防火墙放开tcp 23端口,同时下载所需文件,故写了2个脚本 脚本1:下载软件,防火墙放开tcp 23 端口,开启te

Flume官方文档翻译——Flume 1.7.0 User Guide (unreleased version)(一)

Flume 1.7.0 User Guide Introduction(简介) Overview(综述) System Requirements(系统需求) Architecture(架构) Data flow model(数据流模型) Complex flows(复杂流) Reliability(可靠性) Recoverability(可恢复性) Setup(配置)Configuration(配置 Setting up an agent(设置一个agent) Configuring indiv