使用PLink和回声自动执行HP Procruve Switch

问题描述 投票:0回答:1

我正在尝试在Windows的命令提示符下使用Putty \ Plink在HP ProCurve 2510G-24交换机上自动启用/禁用端口。最终,我希望能够运行计划任务来运行批处理文件,从而启用\禁用交换机上的任何端口。

我设法完成以下任务:-Putty \ Plink-在交换机上手动设置“ tty = none”-使用echo命令

使用带有-batch和-ssh标志的plink,tty = none,并且第一个回声至少带有“空格” /任何字符,使我登录并经过“按任意键继续...”提示, -互动地。 (这是我发现我们都遇到了麻烦!!)

理论上显示的第二个命令是可以使用的,但是我的输出是“接口”未被识别为内部或外部命令,可操作程序或批处理文件。“

-m值显然不适用于将命令从文本文件传递到HP,当不使用-m标志以及使用-N / -s时,Plink似乎可以启动shell。它挂了。

第三个是应该起作用的,但似乎无法传递命令:config interface 2 enable

C:\Windows\system32>echo /config| plink.exe -batch -ssh [email protected] -pw 12345678 -v 
Looking up host "192.168.1.2" for SSH connection 
Connecting to 192.168.1.2 port 22 
We claim version: SSH-2.0-PuTTY_Release_0.73 
Remote version: SSH-2.0-OpenSSH_3.7.1p2 
 Using username "admin". 
Sent password 
Access granted 
Opening main session channel 
Opened main channel 
Allocated pty 
Started a shell/command

ProCurve J9279A Switch 2510G-24 Software revision Y.11.12

Copyright (C) 1991-2009 Hewlett-Packard Co. All Rights Reserved.

                       RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subdivision (b) (3) (ii) of the Rights in Technical Data and Computer Software clause at 52.227-7013.

     HEWLETT-PACKARD COMPANY, 3000 Hanover St., Palo Alto, CA 94303
Press any key to continue

tty=none DC PC SW 2510G24 1# config

tty=none DC PC SW 2510G24 1(config)#

C:\Windows\system32>echo.config && interface 16| plink.exe -batch -ssh [email protected] -pw 12345678 
config
'interface' is not recognized as an internal or external command, operable program or batch file.```


C:\Windows\system32>plink.exe -batch -ssh [email protected] -pw 12345678 [-N/-s] -m c:\scripts.[txt/bat]
putty plink
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.