Link to home
Start Free TrialLog in
Avatar of cpatte7372
cpatte7372Flag for United Kingdom of Great Britain and Northern Ireland

asked on

VBS Script to Stop Logging

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

ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cpatte7372

ASKER

Got it sorted, but thanks anyway...