?
Solved

VBS Script to Stop Logging

Posted on 2012-04-01
2
Medium Priority
?
287 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 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

762 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