Command Prompt Response


gfd

Active member
Local time
3:48 PM
Posts
13
OS
Windows
Greetings,

I am trying to write a batch file which will use SSH to connect with a managed switch. Once connected, I would like to turn the POE on or off for a single port on the switch. Here is the command prompt routine. My input is in bold letters and RETURN is my use of the enter key:

C:\Users\goofy>plink admin@192.168.xx.xxx
Using username "admin".
Further authentication required
admin@192.168.xx.xxx's password: password

Access granted. Press Return to begin session.
RETURN

SX3206HPP>enable
RETURN

SX3206HPP#config
RETURN
SX3206HPP(config)#interface ten-gigabitEthernet 1/0/4
RETURN
SX3206HPP(config-if)#power inline supply enable
RETURN
SX3206HPP(config-if)#end
RETURN
SX3206HPP#exit
RETURN
SX3206HPP>exit
RETURN
C:\Users\goofy>

I would like to convert this to a batch file, where any required input is part of the batch file

I use several batch files, but I am new to networking and have never responded to a password with data typed in the batch file. Also, the use of the enter key is required several times. Thanks in advance for any help you can offer.

Graham

Windows 11 24H2 26100.3476
 

My Computer

System One

  • OS
    Windows
    Computer type
    PC/Desktop
    Manufacturer/Model
    ASRock/AMD
    CPU
    AMD 7950X
    Motherboard
    ASRock X670E Taichi
    Memory
    2 x 32GB G.Skill Flare X5 5600
    Graphics Card(s)
    Asus Tuff GTX 1660 Ti
    Sound Card
    Onboard Realtek USB Audio
    Monitor(s) Displays
    Asus VG289Q 28"
    Screen Resolution
    4K
    Hard Drives
    1 x Samsung 970 Evo Plus 1TB NVMe
    3 x Samsung 970 Evo Plus 2TB NVMe
    4 x 2TB SATA RAID10
    1 x External WD My Book 8TB
    PSU
    Seasonic 1000W Gold
    Case
    Fractal Design Meshify 2
    Cooling
    Arctic Liquid Freezer II 360mm, 5 x 120mm Noctua Redux
    Keyboard
    Logitech MX Keys
    Mouse
    Logitech MX Master 3S
    Internet Speed
    1Gb
    Browser
    Microsoft Edge
    Antivirus
    Microsoft Defender
While you could feed a sequence of ECHO lines piped through plink, just use plink's command-line options.
Code:
@echo off
plink.exe -ssh admin@192.168.0.0.1 -pw abc1234 -batch "enable; config; interface ten-gigabitEthernet 1/0/4; power inline supply enable; end; exit; exit"
 

My Computer

System One

  • OS
    Windows 7
  • Like
Reactions: gfd

Latest Support Threads

Back
Top Bottom