sComputer = "."
sNameSpace = "root/CIMV2"
Set cInstances = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
sComputer & "/" & sNameSpace). _
ExecQuery("Select * from Win32_NetworkAdapter WHERE NetConnectionStatus=2")
For Each oInstance In cInstances
WScript.StdOut.WriteLine(oInstance.Properties_("NetConnectionID").Value)
Next
Запускать его лучше так: cscript.exe //nologo файл.vbs