Win32_NetworkConnection class

The Win32_NetworkConnection WMI classrepresents an active network connection in a Windows-based environment.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties and methods are in alphabetic order, not MOF order.

Syntax

[Dynamic, Provider("CIMWin32"), UUID("{8502C4CD-5FBB-11D2-AAC1-006008C78BC7}"), AMENDMENT]
class Win32_NetworkConnection : CIM_LogicalElement
{
  string   Caption;
  string   Description;
  datetime InstallDate;
  string   Status;
  uint32   AccessMask;
  string   Comment;
  string   ConnectionState;
  string   ConnectionType;
  string   DisplayType;
  string   LocalName;
  string   Name;
  boolean  Persistent;
  string   ProviderName;
  string   RemoteName;
  string   RemotePath;
  string   ResourceType;
  string   UserName;
};

Members

The Win32_NetworkConnection class has these types of members:

Properties

The Win32_NetworkConnection class has these properties.

AccessMask

Data type: uint32

Access type: Read-only

Qualifiers: Schema ("Win32")

List of access rights to the given file or directory held by the user or group on whose behalf the instance is returned. On FAT volumes, the FULL_ACCESS value is returned instead, indicating no security has been set on the object.

FILE_READ_DATA (file) or FILE_LIST_DIRECTORY (directory) (1)

Grants the right to read data from the file. For a directory, this value grants the right to list the contents of the directory.

FILE_WRITE_DATA (file) or FILE_ADD_FILE (directory) (2)

Grants the right to write data to the file. For a directory, this value grants the right to create a file in the directory.

FILE_APPEND_DATA (file) or FILE_ADD_SUBDIRECTORY (4)

Grants the right to append data to the file. For a directory, this value grants the right to create a subdirectory.

FILE_READ_EA (8)

Grants the right to read extended attributes.

FILE_WRITE_EA (16)

Grants the right to write extended attributes.

FILE_EXECUTE (file) or FILE_TRAVERSE (directory) (32)

Grants the right to execute a file. For a directory, the directory can be traversed.

FILE_DELETE_CHILD (directory) (64)

Grants the right to delete a directory and all of the files it contains (its children), even if the files are read-only.

FILE_READ_ATTRIBUTES (128)

Grants the right to read file attributes.

FILE_WRITE_ATTRIBUTES (256)

Grants the right to change file attributes.

DELETE (65536)

Grants delete access.

READ_CONTROL (131072)

Grants read access to the security descriptor and owner.

WRITE_DAC (262144)

Grants write access to the discretionary access control list (DACL).

WRITE_OWNER (524288)

Assigns the write owner.

SYNCHRONIZE (1048576)

Synchronizes access and allows a process to wait for an object to enter the signaled state.

Caption

Data type: string

Access type: Read-only

Qualifiers: MaxLen (64), DisplayName ("Caption")

A short textual description of the object.

This property is inherited from CIM_ManagedSystemElement.

Comment

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|lpComment")

Comment supplied by the network provider.

ConnectionState

Data type: string

Access type: Read-only

Qualifiers: MaxLen (20), MappingStrings ("Win32API|Network Management Structures|USE_INFO_1|ui1_status")

Current state of the network connection.

Connected ("Connected")

Error ("Error")

Paused ("Paused")

Disconnected ("Disconnected")

Connecting ("Connecting")

Reconnecting ("Reconnecting")

ConnectionType

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|dwScope")

Persistence type of the connection used for connecting to the network.

Current Connection ("Current Connection")

Persistent Connection ("Persistent Connection")

Description

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Description")

A textual description of the object.

This property is inherited from CIM_ManagedSystemElement.

DisplayType

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|dwDisplayType")

Network object should be displayed in a network browsing user interface.

Domain ("Domain")

Generic ("Generic")

Server ("Server")

Share ("Share")

InstallDate

Data type: datetime

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|ComponentID|001.5"), DisplayName ("Install Date")

Indicates when the object was installed. Lack of a value does not indicate that the object is not installed.

This property is inherited from CIM_ManagedSystemElement.

LocalName

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|lpLocalName")

Local name of the connected network device.

Example: "c:\public"

Name

Data type: string

Access type: Read-only

Qualifiers: key, Override ("Name"), MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE")

Name of the current network connection. It is the combination of the values in RemoteName and LocalName.

Example: "\\NTRELEASE (c:\public)"

Persistent

Data type: boolean

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Functions|WNetEnumResource")

Connection will be reconnected automatically by the operating system on the next logon.

ProviderName

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|lpProvider")

Name of the provider that owns the resource. This property can be NULL if the provider name is unknown.

RemoteName

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|lpRemoteName")

Remote network resource name for a network resource. For a current or persistent connection, RemoteName contains the network name associated with the name of the value in the LocalName property. The name in RemoteName must follow the network provider's naming conventions.

Example: "\\NTRELEASE"

RemotePath

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|lpRemoteName")

Full path to the network resource.

Example: "\\infosrv1\public"

ResourceType

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Structures|NETRESOURCE|dwType")

Type of resource to enumerate or connect to.

Disk ("Disk")

Print ("Print")

Any ("Any")

Status

Data type: string

Access type: Read-only

Qualifiers: MaxLen (10), DisplayName ("Status")

String that indicates the current status of the object. Operational and non-operational status can be defined. Operational status can include "OK", "Degraded", and "Pred Fail". "Pred Fail" indicates that an element is functioning properly, but is predicting a failure (for example, a SMART-enabled hard disk drive).

Non-operational status can include "Error", "Starting", "Stopping", and "Service". "Service" can apply during disk mirror-resilvering, reloading a user permissions list, or other administrative work. Not all such work is online, but the managed element is neither "OK" nor in one of the other states.

This property is inherited from CIM_ManagedSystemElement.

Values include the following:

OK ("OK")

Error ("Error")

Degraded ("Degraded")

Unknown ("Unknown")

Pred Fail ("Pred Fail")

Starting ("Starting")

Stopping ("Stopping")

Service ("Service")

Stressed ("Stressed")

NonRecover ("NonRecover")

No Contact ("No Contact")

Lost Comm ("Lost Comm")

UserName

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Windows Networking Functions|WNetGetUser")

User name or the default user name used to establish a network connection.

Example: "SYSTEM"

Remarks

The Win32_NetworkConnection class is derived from CIM_LogicalElement.

Examples

The following VBScript code sample retrieves information on the local network connection.

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\Root\CIMv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkConnection",,48)
For Each objItem in colItems
    Wscript.Echo "AccessMask: " & objItem.AccessMask
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Comment: " & objItem.Comment
    Wscript.Echo "ConnectionState: " & objItem.ConnectionState
    Wscript.Echo "ConnectionType: " & objItem.ConnectionType
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "DisplayType: " & objItem.DisplayType
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "LocalName: " & objItem.LocalName
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Persistent: " & objItem.Persistent
    Wscript.Echo "ProviderName: " & objItem.ProviderName
    Wscript.Echo "RemoteName: " & objItem.RemoteName
    Wscript.Echo "RemotePath: " & objItem.RemotePath
    Wscript.Echo "ResourceType: " & objItem.ResourceType
    Wscript.Echo "Status: " & objItem.Status
    Wscript.Echo "UserName: " & objItem.UserName
Next

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMV2
MOF
CIMWin32.mof
DLL
CIMWin32.dll

See also

CIM_LogicalElement

Operating System Classes