View Single Post
  #5  
Old 04-08-2013, 03:32 AM
hakelo91 hakelo91 is offline
Registered User
 
Join Date: Mar 2013
Posts: 13
Quote:
Originally Posted by rtb View Post
Hi hakelo91,

How is your script failing?

What specific behavior are you seeing?

Would you be able to post your script now that you have modified it?
Yes, this is my script:

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

crt.Screen.Synchronous = True

Set g_fso = CreateObject("Scripting.FileSystemObject")
Set g_shell = CreateObject("WScript.Shell")

.....................

select case scelta
			case "1"
				.....login string......
				
					
				For Each strHost In THost 
 				If strHost = "" Then Exit For
 					On Error Resume next
					If crt.Session.Connected Then
       	 		Do 
      			crt.Session.Disconnect
          	Loop While crt.Session.Connected
          end if
      	
      	crt.Screen.Synchronous = True
 				crt.Session.Connect "/telnet " & strHost 
 				crt.Screen.WaitForString "Username: "
  			crt.Screen.Send xxx & chr(13)
				crt.Screen.WaitForString "Password: "
				crt.Screen.Send yyy & chr(13)
  			crt.Screen.WaitForString "#"
				crt.Screen.Send "sh run" & chr(13)
				crt.Screen.Send  chr(13)
				crt.Screen.Send  chr(13)
				crt.Screen.WaitForString "#"
				Set objFile = g_fso.OpenTextFile(strLogFile, ForAppending, True)

                    ' If you want the command logged along with the results,
                    ' uncomment the next two lines
                    objFile.WriteLine "Results of command """ & strCommand & _
                        """ sent to host """ & strHost & """: "

                    ' Write out the results of the command and a separator
                    objFile.WriteLine strResult
                    
                    ' Close the log file
                    objFile.Close
				next
			case "2"

......ect
I reported only the important part of the script....

When it open a log txt file? Where is it located?
I tried to connect specifically to a device with a different login (so the session respond with failed authentication) but it skip this device and continue to the cycle of ip.
Help please!
Reply With Quote