网络连接状态建立于断开的VBS脚本
2016-07-07来源:易贤网

断开连接提示

代码如下:

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

2025公考·省考培训课程试听预约报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
推荐信息