Problem with sshkeys.load in VBScript - WeOnlyDo Discussion board

Problem with sshkeys.load in VBScript (wodSSH / wodSSH.NET)

by dcodyer, Tuesday, February 15, 2005, 00:45 (7010 days ago)

Hey there.

I am trying to connect and send a command to Unix via SSH in a VBScript - you know, using the Windows Scripting Host.
When I put the password for the private key file in a variable, it doesn't work- I get an error. When I hard code it, it does work. I really need to be able to pass this value in and not hard code it. What am I doing wrong?

Many thanks in advance.

Here is my script:

Set SSH = CreateObject( WeOnlyDo.wodSSHCom.1 )
Set SSHKeys = CreateObject( WeOnlyDo.Keys.1 )

SSH.Blocking = 1
SSH.LicenseKey = mylicensekey
SSH.Hostname = myhost
SSH.Login = myuserid
SSH.Protocol = 3
SSH.Encryption = 4
SSH.Authentication = 2
SSH.Timeout = 15
Keyfile = c:privatekey-rsa
Keypassword = mypassword

'This next line works
SSHKeys.Load Keyfile, mypassword

'This next line fails
SSHKeys.Load Keyfile,Keypassword

SSH.PrivateKey = SSHKeys.PrivateKey(0)

SSH.Connect()
SSH.WaitFor( > )
TamCommand = ls -l & VbLf

WScript.Echo SSH.Execute(TAMCommand,SSH.Hostname,15)
SSH.Disconnect(1)

Set SSH = Nothing
Set SSHKeys = Nothing

Re: Problem with sshkeys.load in VBScript

by wodSupport, Tuesday, February 15, 2005, 00:53 (7010 days ago) @ dcodyer

If mypass variable holds your key, try to provide it as cstr(mypass) to wodKeys. That should do the trick.

Re: Problem with sshkeys.load in VBScript

by dcodyer, Thursday, February 17, 2005, 13:12 (7007 days ago) @ wodSupport

If mypass variable holds your key, try to provide it as cstr(mypass) to wodKeys. That should do the trick.

It works. Thank you very much!!