-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwitch_Port_shut.vbs
58 lines (40 loc) · 1.03 KB
/
Switch_Port_shut.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
48
49
50
51
52
53
Function SendCommands(header,csv)
STARTLOG csv
crt.Screen.Synchronous = false
crt.Screen.Synchronous = True
stroutput = "Completed"
crt.Screen.Send ("term length 0"& vbCR )
crt.Screen.Send ("sh run"& vbCR )
crt.Screen.Send ("sh ver | inc FastEthernet interfaces"& vbCR )
ports = crt.Screen.WaitForStrings("24 ", "48 ")
crt.Screen.Send ("config t"& vbCR )
'MsgBox ports
IF ports = 1 THEN
p = 24
END IF
IF ports = 2 THEN
p = 47
END IF
'MsgBox p
For n = 1 to p
'strport = csv(n)
'Select Case strport
'Case "1"
crt.Screen.Send ("do show int status | inc Fa0/"&n&" "&vbCR )
result = crt.Screen.WaitForStrings ("notconnect","connected","disabled",60)
crt.Screen.WaitForString("config")
'MsgBox result
IF result = 1 THEN
crt.Screen.Send ("int Fa0/"&n&vbCR )
crt.Screen.Send ("shut"& vbCR )
END IF
'End Select
Next
crt.Screen.Send ("end"& vbCR )
crt.Screen.Send ("wr"& vbCR )
crt.Screen.Send ("exit"& vbCR )
login = crt.Screen.WaitForString("closed.")
''''''change above only
STOPLOG
SendCommands = stroutput
End Function