Disconnect Hint
Copy Code code as follows:
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
Create a connection hint
Copy Code code as follows:
StrComputer = "."
Set objWMIService = GetObject ("winmgmts:\\" & StrComputer & "\root\wmi")
Set colmonitoredevents = Objwmiservice.execnotificationquery _
(' select * from Msndis_statusmediaconnect ')
Do while True
Se T strlatestevent = colmonitoredevents.nextevent
WScript.Echo "A network connection has been made:"
Wscript.ech o Strlatestevent.instancename, now
WScript.Echo
Loop