Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Scripting COMSPEC issues...

Status
Not open for further replies.

Kharold

IS-IT--Management
Jun 24, 2008
2
US
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
----------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top