vbcript and plink help

I have the following line it does not appear to be processing the exit portion
strSSHCmd1 = "cmd.exe /c " & chr(34) & "echo n | C:\apps\GatherEPS\plink.exe -l $user -pw $pass " & Trim(adoRS("EPSIPAddress")) & " exit " & chr(34)

Open in new window

I know it is better to import the keys but due to company requirements that's not an option.

Thanks for any help you can provide
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

why are you using the exit and echo commands?

aikimark -- zone advisor
Robberbaron (robr)Commented:
@akimark i think he is trying to bypass the question about plink wanting to create a ssh key, then exit immediately.

1, piping n to the plink command appears to work for me.
1.1  but if i use ls as the command, it exits immediately without needing the exit command.

C:\tools>echo n | plink -l admin -pw whoknows ls
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1040 c2:xx:fb:9e:xx:e0:e4:84:xxxxxxxxxxxx
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
Store key in cache? (y/n)  > CLI exiting now.

Bye bye. Have a nice day!!!


2. are you certain the EPSIPaddress is being reported correctly ?
2,1 to debug this I would setup the commandline first so you can echo it out.
2.2  maybe your password has a space ?  put quotes around that too.  but then again, where are you getting the $user from ?  if you are trying to use envionment variables, in DOS, use %user%

cmdPlink = "echo n | C:\apps\GatherEPS\plink.exe -l $user -pw $pass " & Trim(adoRS("EPSIPAddress")) & " exit "
wscript.echo cmdPlink

strSSHCmd1 = "cmd.exe /c " & chr(34) & cmdPlink & chr(34)

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.