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 [email protected] "conf terminal; ip scp server enable"

Attempt 2

plink -ssh [email protected] -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
  • 373
  • 1
  • 4
  • 19

2 Answers2

1

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

plink -ssh [email protected] -batch "conf terminal; ip scp server enable"

1

try using ' < ' insted of -m parameter.

The final command will look like this

plink -ssh [email protected] -pw password_something < do-stuff.txt  > output.txt

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

bjoster
  • 4,805
  • 5
  • 25
  • 33