View Single Post
  #1  
Old 08-22-2020, 09:19 AM
ananthaa2000 ananthaa2000 is offline
Registered User
 
Join Date: Aug 2020
Posts: 3
If condition in vbs

Hi

I seek your guidance for if condition for below script

Below script for login multiple nodes and execute some commands

When I execute below script in SecureCRT ,when the node asks "(yes/no)? " then it send Yes then next line is password and but it is not sending ..it is waiting for password

*************************************************************

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("C:/vblist.txt")

Do Until f.AtEndOfStream

crt.Screen.Synchronous = True
crt.Screen.Send "ssh -l admin " & f.ReadLine & VbCr
crt.Screen.WaitForString "(yes/no)?"
crt.Screen.send "yes" & VbCr
crt.Screen.WaitForString "password:"
crt.Screen.Send "password" & VbCr
crt.Screen.WaitForString "#"
crt.Screen.Send "sh clock" & VbCr
crt.Screen.WaitForString "#"
crt.Screen.Send "exit" & VbCr
crt.Screen.WaitForString "closed." & VbCr
crt.Screen.Synchronous = False


Loop

f.Close

*************************************************************
Reply With Quote