欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

网络连接状态建立于断开的VBS脚本

程序员文章站 2022-07-04 20:38:24
断开连接提示 复制代码 代码如下: strcomputer = "." set objwmiservice = getobject("winmgmts:\\" & strc...
断开连接提示
复制代码 代码如下:

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