script command plink.exe

Post Reply
estebanfull
Member
Posts: 6
Joined: 09 Dec 2016 09:55

script command plink.exe

Post by estebanfull » 09 Dec 2016 10:09

Hello, i tried to create a script with plink which it execute commands in a file .txt
It contains : start C:\Users\Administrateur\Desktop\plink.exe -ssh 10.1.1.1 -t -l admin -pw switch -m command.txt

the command.txt contains just "mkdir test"

start C:\Users\Administrateur\Desktop\plink.exe -ssh 10.1.1.1 -t -l admin -pw switch < command.txt doesn't work too

it result with an "FATAL Error"


with powershell there is this error :
plink.exe : FATAL ERROR: Server sent disconnect message
+ CategoryInfo : NotSpecified: (FATAL ERROR: Se...connect message:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

type 2 (protocol error):
"ssh + command not available"

can you please help me to fix it

User avatar
tgn
Member
Posts: 699
Joined: 30 Dec 2009 17:59
Location: Germany

Re: script command plink.exe

Post by tgn » 11 Dec 2016 08:38

plink doesn't use local command files. you can only start scripts, that are present in the remote file system.

regards...


--- back to basics... focus your eyes to the essential things... ---
--- back to basics... focus your eyes to the essential things... ---

estebanfull
Member
Posts: 6
Joined: 09 Dec 2016 09:55

Re: script command plink.exe

Post by estebanfull » 12 Dec 2016 04:30

Thanks to you for reply, I tried to run a .sh in /flash with "mkdir test" inside but it doesn't work. How can I start it please?
There is always the same error

User avatar
tgn
Member
Posts: 699
Joined: 30 Dec 2009 17:59
Location: Germany

Re: script command plink.exe

Post by tgn » 12 Dec 2016 08:28

have tried it with a ssh via plink to a linux system. and it works (even with the option -m for local commandfile > which i've never used before :) )...
Are you sure that "mkdir test" is possible via a "normal" ssh-session?

regards...


--- back to basics... focus your eyes to the essential things... ---
--- back to basics... focus your eyes to the essential things... ---

User avatar
tgn
Member
Posts: 699
Joined: 30 Dec 2009 17:59
Location: Germany

Re: script command plink.exe

Post by tgn » 12 Dec 2016 08:32

Also try plink without any options.

regards...


--- back to basics... focus your eyes to the essential things... ---
--- back to basics... focus your eyes to the essential things... ---

estebanfull
Member
Posts: 6
Joined: 09 Dec 2016 09:55

Re: script command plink.exe

Post by estebanfull » 12 Dec 2016 08:40

start C:\Users\Administrateur\Desktop\plink.exe -ssh 10.1.1.1 -t -l admin -pw switch
It works
"Welcome to the Alcatel-Lucent OmniSwitch 6000
Software Version 6.3.1.1052.R01 Service Release, December 11, 2008.

Copyright(c), 1994-2007 Alcatel-Lucent. All Rights reserved.

OmniSwitch(TM) is a trademark of Alcatel-Lucent registered
in the United States Patent and Trademark Office." appears

with "-m file.txt" or "< file.txt" or just a command after the password it doesn't works there is the same error
"mkdir test" works when I use putty and that I write it myself...

Regards

estebanfull
Member
Posts: 6
Joined: 09 Dec 2016 09:55

Re: script command plink.exe

Post by estebanfull » 12 Dec 2016 09:59

Please find attached the error that powershell and plink evoke

Regards
You do not have the required permissions to view the files attached to this post.

User avatar
tgn
Member
Posts: 699
Joined: 30 Dec 2009 17:59
Location: Germany

Re: script command plink.exe

Post by tgn » 12 Dec 2016 14:15

the server closes the connection because the execution of pure commands without a ssh-session is not supported.

maybe this example for a cisco switch will lead you to success -> https://zeleskitech.com/2014/08/02/send ... owershell/
it opens a ssh.session and sends the commands trough an input stream object.

i've found it with a simple google search. https://www.google.de/search?q=ssh+powe ... 8gfYkbq4Cw

if it works pelase share it :)

may the force be with you ;)

regards...
--- back to basics... focus your eyes to the essential things... ---

estebanfull
Member
Posts: 6
Joined: 09 Dec 2016 09:55

Re: script command plink.exe

Post by estebanfull » 13 Dec 2016 08:30

Hello, first of all thanks to you for your response and your involvement :) . I tried the solution that you have proposed and there are a number of errors. So I tried this solution from PowerShell Module and I noticed that the connection was apparently fine but there is no index associated with the connection (necessary when calling the command "Get-SSHSession"). I think this is not normal compared to what I found on internet, so I still do not know what to do.
You can find attached what I have done on PowerShell module..

Regards
You do not have the required permissions to view the files attached to this post.

estebanfull
Member
Posts: 6
Joined: 09 Dec 2016 09:55

Re: script command plink.exe

Post by estebanfull » 14 Dec 2016 07:53

So I updated PowerShell and I got a number for the SessionID but when I try to send a command it say me that the client is not connected and just before it say connected : true
You do not have the required permissions to view the files attached to this post.

Post Reply

Return to “OmniSwitch 6850 / 6850E”