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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is PuTTy scripting possible?

Status
Not open for further replies.

DisasterMaster

Technical User
Feb 2, 2012
223
US
Does anyone know if it is possible to write a simple script with PuTTy that will login to a cs1000, access LD 20 and print some stuff,capture the stuff to a file and then logout? [ponder]
 
I just got my hands on secureCRT.
So what I have learned thus far is that in order to run a script that I recorded from previous a PBX session, I have to launch secureCRT, access the PBX and then run the script.
I would like to automate the entire process from actually launching secureCRT, logging into the PBX, running the script, and then saving the capture to file on my computer.
Any ideas how to accomplish this?
Maybe some sort of BAT file on a scheduler?
 
You can use tomcat.exe to execute scripts for SecureCRT that are written in vbscript and automate the whole process, I do this as a call from Visual Basic in MS Outlook to manipulate phantom forwarding based on the contents of received emails. BUT: the logi and passwords have to be contained in the scripts; if anyone else has access to those scripts, it will be a security risk...

30n30w
 
Thanks for the reply.
As a test, I recorded a simple script to login to the PBX and stat PRIs in LD60.
Whenever I try to run the script I get an error theat says "Error: Screen.WaitForString: not connected".
Any idea what the fix would be?

Here's the actual script...
Code:
#$language = "VBScript"
#$interface = "1.0"

crt.Screen.Synchronous = True

' This automatically generated script may need to be
' edited in order to work correctly.

Sub Main
	crt.Screen.WaitForString ">"
	crt.Screen.Send "ld 60" & chr(13)
	crt.Screen.WaitForString "."
	crt.Screen.Send "stat" & chr(13)
	crt.Screen.WaitForString "."
	crt.Screen.Send "****" & chr(13)
	crt.Screen.WaitForString ">"
	crt.Screen.Send "logo" & chr(13)
End Sub

 
i think the issue is that when i recoded the script, it didn't pick up the part where I logged in to the PBX. What sort of command line would I need in the script to perform the login/pass to the switch?
 
Not sure if you need all the statements below - but I never did audit and clean this code up to see which statements I could take out....I know this crt.script works for me, so I left it alone....
I can't recall now if it was the chr(13) or the vbcr that actually kicked it....
The "MeridianSession" is a stored connect profile that uses Rlogin with the correct CPSID to make the connection.

Good Luck!
30n30w




If crt.Session.Connected Then crt.Session.Disconnect
crt.Session.Connect "/S MeridianSession"
crt.Screen.Synchronous = True
crt.Screen.Send chr(13)
crt.Sleep 1000
crt.Screen.Send chr(13)
crt.Screen.Send vbcr
crt.Sleep 1000
crt.Screen.Send chr(13)


Sub Main
crt.Screen.Send chr(13)
crt.Screen.Send chr(13)
crt.Screen.Send vbcr
crt.Screen.Send chr(13)
crt.Sleep 1000
crt.Screen.Send chr(13)
crt.Screen.Send chr(13)
crt.Screen.WaitForString ">"
crt.Screen.Send "LOGI ADMIN1" & chr(13)
crt.Screen.WaitForString "PASS?"

etc..etc...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top