Solved

VBS Script to Stop Logging

Posted on 2012-04-01
2
266 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
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 …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now