网络连接状态建立于断开的VBS脚本
程序员文章站
2022-04-10 08:14:08
断开连接提示 复制代码 代码如下: 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
复制代码 代码如下:
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