网络连接状态 网络连接状态建立于断开的VBS脚本
人气:0想了解网络连接状态建立于断开的VBS脚本的相关内容吗,在本文为您仔细讲解网络连接状态的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:断开连接,建立连接,下面大家一起来学习吧。
断开连接提示 复制代码 代码如下:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\wmi")
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 & "\root\wmi")
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
加载全部内容