当前位置:网站首页>Use the securecrtportable script function to read data from network devices
Use the securecrtportable script function to read data from network devices
2022-06-11 22:09:00 【dawn】
Always use SecureCRTPortable To maintain network devices .
There are too many network commands , I find the work tedious and boring , One of the daily tasks is to frequently read the data records of network devices from network devices , Previously used Python Script to complete , It's very convenient , It is not used again Python, To use now, you must install Python, Don't want to toss .
Come across SecureCRTPortable With script recording function , Check on the Internet , It can execute scripts , Include VBScript、JavaScript and Python, It's so good !
I checked the relevant information this afternoon , utilize VBScript Completed the previous use Python Finished function .
The script is as follows :
#$language = "VBScript"
#$interface = "1.0"
crt.Screen.Synchronous = True
crt. Window.show 0
'crt.Window.State 0
Sub Main
dim NetEquipmentName
dim NetEquipmentIP
dim UserName
dim UserPwd
dim LogFileName
dim LogPath
' Set parameters
NetEquipmentName=" Network device name "
NetEquipmentIP="IP Address "
UserName=" user name "
Userpwd=" password "
LogPath=" File path "
LogFileName=LogPath & NetEquipmentName & Year(Now) & Month(Now) & Day(Now) & "-" & Hour(Now) & Minute(Now) & ".txt"
' Access network devices
crt.session.Connect("/telnet " & NetEquipmentIP )
'crt.Window.Activate
'crt. Window.show 0
'crt.Window.State=0
crt.Screen.WaitForString("ogin:")
crt.Screen.Send(UserName & chr(13))
crt.Screen.WaitForString("assword:")
crt.Screen.Send(UserPwd & chr(13))
crt.Screen.WaitForString("<xxs01>")
crt.Session.LogFileName=LogFileName
crt.Session.Log True
crt.Screen.Send " command " & chr(13)
Do while crt.Screen.WaitForString("---- More ----",1,true)=True
crt.Sleep(500)
crt.Screen.Send " " & chr(13)
Loop
crt.Screen.Send "quit" & chr(13)
crt.Session.Disconnect()
' Exit procedure
crt.Screen.Synchronous = False
crt.quit()
End Sub
Write a bat file , There's only one line :
File path \SecureCRT.exe /SCRIPT DailyNetworkDataCollection.vbsstay windows Add this to your plan list bat File can be installed for a fixed time .
This function is really practical ! A lot of work has been reduced !
边栏推荐
- All inherited features
- STM32开发笔记112:ADS1258驱动设计——读寄存器
- Matplotlib和tkinter学习笔记(一)
- 6.项目上线
- R language book learning 03 "in simple terms R language data analysis" - Chapter 8 logistic regression model Chapter 9 clustering model
- 图书管理系统
- Huawei equipment configuration h-vpn
- MySQL事务简介
- Inner join execution plan changed
- [academic related] under the application review system, how difficult is it to study for a doctoral degree in a double first-class university?
猜你喜欢

高考结束,人生才刚刚开始,10年职场老鸟给的建议

机器学习之线性回归简单实例

Why is the printer unable to print the test page

How to view computer graphics card information in win11

Superscalar processor design yaoyongbin Chapter 2 cache -- Excerpt from subsection 2.2

R语言相关文章、文献整理合集(持续更新)

Win10弹出USB时出现该设备正在使用的解决方法

Classes and objects (3)

学习位段(1)

One question per day -- verifying palindrome string
随机推荐
每日一题 -- 验证回文串
3.3 测试模块的命名规则
Popular science | what are the types of NFT (Part 1)
【学术相关】申请审核制下,到双一流大学读博的难度有多大?
移动端——swipe特效之图片时间轴
206. reverse linked list
【数据挖掘时间序列分析】餐厅销量预测
Leetcode - 第2天
STM32 development note 113:ads1258 drive design - reading temperature value
One question of the day - delete duplicates of the ordered array
C语言实现八种排序(3)
189. rotation array
Inner join execution plan changed
机器学习之线性回归简单实例
Nmap进行主机探测出现网段IP全部存活情况分析
C language implements eight sorts (1)
快速排序的优化
Matlab: solution of folder locking problem
[niuke.com] ky41 put apples
Sword finger offer array question type summary