I try to create a script for automatically connect to SSH. I have a variables with all parameters of SSH (username, password, port, ip).
If I launch, in a VBS script:
Set objShell = CreateObject("Wscript.shell")
objShell.run("powershell -noexit ssh.exe " & user & "@" & ip & " -p " & port & "")
the powershell opens correctly and ask me a password of server...but
How can I send the password in VBS script? I have variable "pass" with the password of server (SSH).
Please Help me I have try a lot of solutions but it's doesn't works.
I have try with:
objShell.run("powershell -noexit & ssh.exe " & user & "@" & ip & " -p " & porta & "; " & pass &"")
objShell.run("powershell -noexit ssh.exe " & user & "@" & ip & " -p " & porta & " + " & pass &"")
with ";" the script passed the password but it doesn't send it when ssh ask me a password.
Also, I would ask the obvious question, why not write it all in powershell?
I already have a script in VBS and I want to change only the line of connection (now works fine with cygwin).
Why run it from PowerShell at all? Just run ssh.exe directly. Or even easier, just run the ssh command directly from the PowerShell prompt (PowerShell is a shell; it can run commands you type - that's one of the reasons it exists).
I must launch powershell from a script and send the password of SSH automatically (I don't want to type the password manually).