0

I'd like to execute a set of commands on a cisco device:

conf terminal
ip scp server enable

When performed manually using putty, this works fine. I'm trying to do the same using plink, but have been unsuccessful.

Attempt 1

plink -ssh user@192.168.1.1 "conf terminal; ip scp server enable"

Attempt 2

plink -ssh user@192.168.1.1 -m script.sh

It appears that an "Enter" keystroke must be sent after the configure terminal command. Others. have used VBScript to send the keystroke. Is it possible to do this natively in plink instead?

Fidel
  • 363
  • 1
  • 4
  • 18

2 Answers2

1

to avoid the "Enter" keystroke, you can add the -batch option :

plink -ssh user@192.168.1.1 -batch "conf terminal; ip scp server enable"

1

try using ' < ' insted of -m parameter.

The final command will look like this

plink -ssh user@192.168.1.1 -pw password_something < do-stuff.txt  > output.txt

In this case, your do-stuff.txt can contain multiple lines and Newslines (Enter).

bjoster
  • 4,423
  • 5
  • 22
  • 32