Solved

VBS Script to Stop Logging

Posted on 2012-04-01
2
285 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

724 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