All:
I am trying to code a script that will SSH into an Aruba wireless controller. The issue with the script is in the connection procedure - the script has the correct switches to pass the password, but not before the controller responds, sending text to the CMD window.
Is there a limitation with %COMSPEC% that will prevent a script from sending text correctly when the controller sends text first?
Is there a way to pass an inline pause with a %comspec% command from a different line, yet still referencing the previously created CMD window? I tried passing inline using "& WScript.sleep(#) &", but it only pauses the script prior to passing any variables.
My Code is below:
--------------------------------------------------------
Option Explicit
Dim objShell, strIPAddr
strIPAddr = 'IP ADDRESS removed for security purposes
Set objShell = CreateObject("WScript.Shell")
objShell.Run ("%comspec% /k cd\ & cd Program Files\PuTTY & plink -ssh " & strIPAddr & " -l username" &_
WScript.Sleep(900) & "-pw password & en & password &_
show local-userdb-guest")
‘ prior to sending –pw password, the controller echos back:
‘ “username@IP address password” – and the script hangs there, with the CMD window prompting for input
Set objShell = Nothing
WScript.Quit
----------------------------------------------------
I am trying to code a script that will SSH into an Aruba wireless controller. The issue with the script is in the connection procedure - the script has the correct switches to pass the password, but not before the controller responds, sending text to the CMD window.
Is there a limitation with %COMSPEC% that will prevent a script from sending text correctly when the controller sends text first?
Is there a way to pass an inline pause with a %comspec% command from a different line, yet still referencing the previously created CMD window? I tried passing inline using "& WScript.sleep(#) &", but it only pauses the script prior to passing any variables.
My Code is below:
--------------------------------------------------------
Option Explicit
Dim objShell, strIPAddr
strIPAddr = 'IP ADDRESS removed for security purposes
Set objShell = CreateObject("WScript.Shell")
objShell.Run ("%comspec% /k cd\ & cd Program Files\PuTTY & plink -ssh " & strIPAddr & " -l username" &_
WScript.Sleep(900) & "-pw password & en & password &_
show local-userdb-guest")
‘ prior to sending –pw password, the controller echos back:
‘ “username@IP address password” – and the script hangs there, with the CMD window prompting for input
Set objShell = Nothing
WScript.Quit
----------------------------------------------------