站长资源脚本专栏

VBS 断网后自动关机30秒后

整理:jimmy2024/12/27浏览2
简介复制代码 代码如下:Dim Wsh,objWMIService,colMonitoredEvents Set Wsh = WScript.CreateObject("WScript.Shell") Set objWMIService = GetObject("winmgmts:\. ootwmi")
复制代码 代码如下:
Dim Wsh,objWMIService,colMonitoredEvents
Set Wsh = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\. ootwmi")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery("Select * from MSNdis_StatusMediaDisconnect")
Do While True
Set strLatestEvent = colMonitoredEvents.NextEvent
Wsh.run "shutdown -s -t 30 -c "&chr(34)&"系统网络断开,机器即将关闭"&chr(34)
Loop