Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a bash script to login into one of my storage device and execute couple of commands and saves output into one text file. Here's the code.

plink.exe -ssh root@10.10.10.10 -pw password1 "storage-controllers" >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
echo. >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
echo ############################################################ >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
echo. >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt

Here problem is... at my storage level if i want to login into the command line it has 2 levels of username and password like below.

login as: XXXXXX
XXXXXX@10.0.0.0's password:
Last login: Wed Sep 28 12:29:42 2016 from 10.123.253.118
This service is restricted to authorized users only. All activities on this system are logged.
Username: XXXX
Password:
Connect XMS on 10.0.0.0:443: version 4.0.2 build 80
xmcli (XXXX)>

So here with the above code I am able to go till first level username and password and not able to go to second level of username and password to execute my command.

Please help me.....how can i cross second level of username and password to execute the commands, give me some suggestions.

What I have tried:

I have tried to put both username and passwords in the same line like below.

plink.exe -ssh root@10.10.10.10 -pw password1 "admin" -pw password2 "storage-controllers" >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt

But this is not working and it's not executing the command.
Posted
Updated 3-Oct-16 6:22am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900