Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 12-30-2018, 11:26 PM
amy_itx_aps amy_itx_aps is offline
Registered User
Join Date: Dec 2018
Posts: 8
SecureCRT vbs script Read files log in a lot of Unix

The vbs script reads the information in the file and logs in to Unix in bulk.

1. ip_uu_pass_path.txt four columns of information

ip user password path oracle oracle /home/oracle/data app app /home/app han han /home/han


ssh2_auto_read-ip_user_pass.vbs Loop read ip_uu_pass_path.txt login Unix

ssh2_auto_read-ip_user_pass.vbs Script content:

#$language = "VBScript"
#$interface = "1.0"

'turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True

Sub Main

Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile("ip_uu_pass.txt")

crt.Window.Show 3

Do Until file.AtEndOfStream
line = file.ReadLine
commendAndLog line
crt.screen.send chr(13)


End Sub

Sub commendAndLog(line)
' turn off synchronous mode to restore normal input processing

crt.Screen.Synchronous = False

equipmentInfo = Split(line)
ip = equipmentInfo(0)
uname = equipmentInfo(1)
pwd = equipmentInfo(2)

'login unix
crt.session.ConnectInTab "/SSH2 /L "&uname&" /PASSWORD "&pwd&" "&ip


crt.Screen.Send "pwd" & chr(13)

crt.Screen.Send "clear && pwd && whoami" & chr(13)

End Sub
Reply With Quote


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 01:12 AM.