Describe
Retrieves information about all active network connections on the computer.
For more information about the Win32_networkconnection categories used in this code, click here.
Support Platform
Windows Server 2003 |
Is |
Windows XP |
Is |
Windows 2000 |
Is |
Windows NT 4.0 |
Yes, with WMI installed |
Scripting code
Copy Code code as follows:
On Error Resume Next
StrComputer = "."
Set objWMIService = GetObject ("winmgmts:\\" & StrComputer & "\root\cimv2")
Set colitems = objWMIService.ExecQuery ("SELECT * from Win32_networkconnection")
For each objitem in colitems
WScript.Echo "Access Mask:" & Objitem.accessmask
WScript.Echo "Caption:" & objitem.caption
WScript.Echo "Connection State:" & Objitem.connectionstate
WScript.Echo "Connection Type:" & Objitem.connectiontype
WScript.Echo "Description:" & objitem.description
WScript.Echo "Display Type:" & Objitem.displaytype
WScript.Echo "Local Name:" & Objitem.localname
WScript.Echo "Name:" & objItem.Name
WScript.Echo "Persistent:" & Objitem.persistent
WScript.Echo "Provider Name:" & Objitem.providername
WScript.Echo "Remote Name:" & Objitem.remotename
WScript.Echo "Remote Path:" & Objitem.remotepath
WScript.Echo "Resource Type:" & Objitem.resourcetype
WScript.Echo "User Name:" & Objitem.username
WScript.Echo
Next