-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcisco_log.vbs
48 lines (42 loc) · 1.74 KB
/
cisco_log.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# $language = "VBScript"
# $interface = "1.0"
'--------------------------------------------------------------
'Cisco IOS
'
'Created by David Gomez, davidgomez.255@gmail.com
'---------------------------------------------------------------
Sub Main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
Dim bStartLog, bAppendToLog
crt.session.log True, True
crt.Screen.Send "!-----Begin---" & VbCr
crt.Screen.WaitForString "#"
'This will grab the hostname and use it to save the log file
Set objTab = crt.GetScriptTab()
nRow = objTab.Screen.CurrentRow
hostname = objTab.screen.Get(nRow, 0, nRow, objTab.Screen.CurrentColumn - 2)
hostname = Trim(hostname)
crt.Session.LogFileName = ("C:\Running_Capture\"& hostname & ".txt")
crt.Screen.Send "term length 0" & VbCr
crt.Screen.WaitForString "#"
crt.Screen.Send "!" & VbCr
crt.Screen.WaitForString "#"
crt.Screen.Send "!############################################################" & VbCr
crt.Screen.Send "!This command will Log the Running Config on a Cisco Device" & VbCr
crt.Screen.Send "!Revision 1.0" & VbCr
crt.Screen.Send "!############################################################" & VbCr
crt.Screen.WaitForString "#"
crt.Screen.Send "!############################################################" & VbCr
crt.Screen.Send "!STARTING EXECUTION" & VbCr
crt.Screen.Send "!############################################################" & VbCr
crt.Screen.WaitForString "#"
crt.Screen.Send "SHOW RUN" & VbCr
crt.Screen.WaitForString "#"
crt.Screen.Send "!" & VbCr
crt.Screen.WaitForString "#"
' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
crt.Sleep 3500
crt.session.log false
end Sub