网络连接状态建立于断开的VBS脚本
网络连接状态建立于断开的VBS脚本
发布时间:2016-12-28 来源:查字典编辑
摘要:断开连接提示复制代码代码如下:strComputer="."SetobjWMIService=GetObject("winmgmts:"&s...

断开连接提示

复制代码 代码如下:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & strComputer & "rootwmi")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _

("Select * from MSNdis_StatusMediaDisconnect")

Do While True

Set strLatestEvent = colMonitoredEvents.NextEvent

Wscript.Echo "A network connection has been lost:"

WScript.Echo strLatestEvent.InstanceName, Now

Wscript.Echo

Loop

建立连接提示

复制代码 代码如下:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & strComputer & "rootwmi")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _

("Select * from MSNdis_StatusMediaConnect")

Do While True

Set strLatestEvent = colMonitoredEvents.NextEvent

Wscript.Echo "A network connection has been made:"

WScript.Echo strLatestEvent.InstanceName, Now

Wscript.Echo

Loop

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新vbs学习
热门vbs学习
脚本专栏子分类