Solved

VBS Script to Stop Logging

Posted on 2012-04-01
2
276 Views
Last Modified: 2012-06-27
Hi All,

The following script starts logging before it goes through the actual body of the script. Can someone tweak the script so that it stops logging after it goes through script?

Sorry for the poor explanation

Cheers

# $language = "VBScript"
# $interface = "1.0"
' SendToAll.vbs

Sub Main()
   
    if Not crt.Session.Connected then
        szSession = crt.Dialog.Prompt("Enter session:", "", "", False)
        if szSession = "" then exit sub
   
        crt.Session.ConnectInTab("/S " & szSession)
        crt.Session.ConnectInTab("/S " & szSession)
        crt.Session.ConnectInTab("/S " & szSession)
    end if
    
    arrCommands = Array("term len 0", "show run", "show ip inte brief", "show cdp neigh",_
        "show spanning-tree summary", "show vlan brief", "show vlan", "show spanning-tree root", _
        "show spanning-tree uplinkfast", "show spanning-tree backbonefast", "show spanning-tree active", "show spanning-tree blockedports",_
        "show spanning-tree mst", "show vtp status", "show interfaces trunk", "show etherchannel summary", "show vlan access-map", "show arp access-list",_ 
	"show vlan filter", "show port-security", "show standby brief", "show ip arp inspection", "show ip route")

    ' Send commands to all tabs
    ' Connect to each tab in order from left to right, issue all commands, and
    ' then disconnect...
	' crt.Session.Log True
    For nIndex = 1 to crt.GetTabCount
        Set objCurrentTab = crt.GetTab(nIndex)
        objCurrentTab.Activate
		
        If objCurrentTab.Session.Connected = True Then
	objCurrentTab.Session.Log True
            For Each strCommand In arrCommands 
                crt.Sleep 500
                objCurrentTab.Screen.Send strCommand & vbcrlf
                crt.Sleep 1000
            Next
        End If
    Next
End Sub

Open in new window

0
Comment
Question by:cpatte7372
2 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 37794814
what do u mean "before it goes through the actual body of the script"?
the code looks fine, loop through all tabs and pass the commands.
0
 

Author Closing Comment

by:cpatte7372
ID: 37853118
Got it sorted, but thanks anyway...
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question