View Single Post
Old 12-31-2018, 12:26 AM
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