Win32_SerialPortConfiguration

The Win32_SerialPortConfiguration WMI class represents the settings for data transmission on a Windows-based serial port. This includes configurations for establishing a connection and error checking.

The Win32_SerialPortConfiguration WMI class represents the settings for data transmission on a Windows-based serial port. This includes configurations for establishing a connection and error checking.

Methods

Win32_SerialPortConfiguration has no methods.

Properties

Win32_SerialPortConfiguration returns 29 properties:

'AbortReadWriteOnError','BaudRate','BinaryModeEnabled','BitsPerByte','Caption',
'ContinueXMitOnXOff','CTSOutflowControl','Description','DiscardNULLBytes','DSROutflowControl',
'DSRSensitivity','DTRFlowControlType','EOFCharacter','ErrorReplaceCharacter',
'ErrorReplacementEnabled','EventCharacter','IsBusy','Name','Parity','ParityCheckEnabled','RTSFlowControlType',
'SettingID','StopBits','XOffCharacter','XOffXMitThreshold','XOnCharacter','XOnXMitThreshold',
'XOnXOffInFlowControl','XOnXOffOutFlowControl'

Unless explicitly marked as writeable, all properties are read-only. Read all properties for all instances:

Get-CimInstance -ClassName Win32_SerialPortConfiguration -Property *

Most WMI classes return one or more instances.

When Get-CimInstance returns no result, then apparently no instances of class Win32_SerialPortConfiguration exist. This is normal behavior.

Either the class is not implemented on your system (may be deprecated or due to missing drivers, i.e. CIM_VideoControllerResolution), or there are simply no physical representations of this class currently available (i.e. Win32_TapeDrive).

AbortReadWriteOnError

BOOLEAN

If TRUE, read and write operations are terminated if an error occurs. If TRUE, the driver terminates all read and write operations with an error status if an error occurs. The driver will not accept any further communications operations until the application acknowledges the error.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, AbortReadWriteOnError

BaudRate

UINT32

Baud (bits per second) rate at which the communications device operates.

Example: 9600

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, BaudRate

BinaryModeEnabled

BOOLEAN

If TRUE, binary-mode data transfers are enabled for the serial port. Computer systems running Windows only allow binary transfers through serial ports, so this value is always TRUE.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, BinaryModeEnabled

BitsPerByte

UINT32

Number of bits transmitted and received for each byte of data for the Windows serial port. The number may vary with control and error correction bits, such as parity bits.

Example: 8

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, BitsPerByte

Caption

STRING MAX 64 CHAR

Short textual description of the current object.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, Caption

ContinueXMitOnXOff

BOOLEAN

If TRUE, data transmissions continue when the input buffer has come within XOffXMitThreshold bytes of being full and the driver has transmitted the XOffChararcter value to stop receiving bytes. If FALSE, transmission does not continue until the input buffer is within XOnXMitThreshold bytes of being empty and the driver has transmitted the XOnCharacter value to resume reception.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, ContinueXMitOnXOff

CTSOutflowControl

BOOLEAN

If TRUE, the clear to send (CTS) signal is checked before transmitting data. CTS signals that both devices on the serial connection are ready to transfer data. Data transmission is suspended until the CTS signal is given.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, CTSOutflowControl

Description

STRING

Textual description of the current object.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, Description

DiscardNULLBytes

BOOLEAN

If TRUE, NULL bytes (characters) are discarded when they are received.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, DiscardNULLBytes

DSROutflowControl

BOOLEAN

If TRUE, data outflow control is enabled when there is a data set ready (DSR) condition. DSR signals that the connection has been established by the devices on the serial connection. DSR data transmission is suspended until the DSR signal is given.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, DSROutflowControl

DSRSensitivity

BOOLEAN

If TRUE, the communications driver is sensitive to the state of the DSR signal. The driver ignores any bytes received, unless the DSR modem input line is high.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, DSRSensitivity

DTRFlowControlType

STRING

Use of the data terminal ready (DTR) flow control after a connection has been established.

Enable (“Enable”)

Disable (“Disable”)

Handshake (“Handshake”)

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, DTRFlowControlType

EOFCharacter

UINT32

Value of the character used to signal the end of data.

Example: ^Z

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, EOFCharacter

ErrorReplaceCharacter

UINT32

Value of the character used to replace bytes received with a parity error.

Example: ^C

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, ErrorReplaceCharacter

ErrorReplacementEnabled

BOOLEAN

If TRUE, bytes received with parity errors are replaced with the ErrorReplaceCharacter value. Characters with parity errors are only replaced if this property is TRUE and the parity is enabled.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, ErrorReplacementEnabled

EventCharacter

UINT32

Value of the control character that is used to signal an event, such as end of file.

Example: ^e

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, EventCharacter

IsBusy

BOOLEAN

If TRUE, the serial port is busy.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, IsBusy

Name

KEY PROPERTY STRING MAX 256 CHAR

Name of the Windows serial port.

Example: “COM1”

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name

Parity

STRING

Method of parity checking to be used. Parity is used as an error checking technique where an extra parity bit is included with every unit of data. The receiver can then verify the validity of the data by counting the bits that are set.

Parity checking not used.

Sets the parity bit so that the count of bits set is an odd number.

Sets the parity bit so that the count of bits set is an even number.

Leaves the parity bit set to 1.

Leaves the parity bit set to 0 (zero).

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, Parity

ParityCheckEnabled

BOOLEAN

If TRUE, parity checking is enabled.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, ParityCheckEnabled

RTSFlowControlType

STRING

Request to send (RTS) flow control. RTS is used to signal that data is available for transmission.

RTS is left on for the data transfer session.

RTS is ignored after the first RTS signal is received.

RTS is turned off if the transmission buffer is more than three-quarters full, and RTS is turned on when the buffer is less than one-half full.

RTS is turned on if there is any data buffered for transmission.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, RTSFlowControlType

SettingID

STRING MAX 256 CHAR

Identifier by which the current object is known.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, SettingID

StopBits

STRING

Number of stop bits to be used. Stop bits separate each unit of data on an asynchronous serial connection. They are also sent continuously when no data is available for transmission.

1 (“1”)

1.5 (“1.5”)

2 (“2”)

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, StopBits

XOffCharacter

UINT32

Value of the XOFF character for both transmission and reception. XOFF is a software control to stop the transmission of data (whereas RTS and CTS are hardware controls). XON resumes the transmission.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, XOffCharacter

XOffXMitThreshold

UINT32

Maximum number of bytes allowed in the input buffer before the XOFF character is sent.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, XOffXMitThreshold

XOnCharacter

UINT32

Value of the XON character for both transmission and reception. XON is a software control to resume the transmission of data (whereas RTS and CTS are hardware controls). XOFF stops the transmission.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, XOnCharacter

XOnXMitThreshold

UINT32

Minimum number of bytes allowed in the input buffer before the XON character is sent. This property works in conjunction with XOffXMitThreshold to regulate the rate at which data is transferred.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, XOnXMitThreshold

XOnXOffInFlowControl

UINT32

If TRUE, XON/XOFF flow control is used during reception. If TRUE, the XOffCharacter value is sent when the input buffer comes within XOffXMitThreshold bytes of being full, and the XOnCharacter value is sent when the input buffer comes within XOnXMitThreshold bytes of being empty.

FALSE

TRUE

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, XOnXOffInFlowControl

XOnXOffOutFlowControl

UINT32

The XOnXOffOutFlowControl specifies whether XON or XOFF flow control is used during transmission. If TRUE, transmission stops when the XOffCharacter value is received and starts again when the XOnCharacter value is received.

Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property Name, XOnXOffOutFlowControl

Examples

List all instances of Win32_SerialPortConfiguration
Get-CimInstance -ClassName Win32_SerialPortConfiguration

Learn more about Get-CimInstance and the deprecated Get-WmiObject.

View all properties
Get-CimInstance -ClassName Win32_SerialPortConfiguration -Property *
View key properties only
Get-CimInstance -ClassName Win32_SerialPortConfiguration -KeyOnly

Selecting Properties

To select only some properties, pipe the results to Select-Object -Property a,b,c with a comma-separated list of the properties you require. Wildcards are permitted.

Get-CimInstance always returns all properties but only retrieves the ones that you specify. All other properties are empty but still present. That’s why you need to pipe the results into Select-Object if you want to limit the visible properties, i.e. for reporting.

Selecting Properties

The code below lists all available properties. Remove the ones you do not need:

$properties = 'AbortReadWriteOnError',
              'BaudRate',
              'BinaryModeEnabled',
              'BitsPerByte',
              'Caption',
              'ContinueXMitOnXOff',
              'CTSOutflowControl',
              'Description',
              'DiscardNULLBytes',
              'DSROutflowControl',
              'DSRSensitivity',
              'DTRFlowControlType',
              'EOFCharacter',
              'ErrorReplaceCharacter',
              'ErrorReplacementEnabled',
              'EventCharacter',
              'IsBusy',
              'Name',
              'Parity',
              'ParityCheckEnabled',
              'RTSFlowControlType',
              'SettingID',
              'StopBits',
              'XOffCharacter',
              'XOffXMitThreshold',
              'XOnCharacter',
              'XOnXMitThreshold',
              'XOnXOffInFlowControl',
              'XOnXOffOutFlowControl'
Get-CimInstance -ClassName Win32_SerialPortConfiguration | Select-Object -Property $properties
Limiting Network Bandwidth

If you work remotely, it makes sense to limit network bandwidth by filtering the properties on the server side, too:

Get-CimInstance -Class Win32_SerialPortConfiguration -Property $property | 
Select-Object -Property $property

Selecting Instances

To select some instances, use Get-CimInstance and a WMI Query. The wildcard character in WMI Queries is % (and not “*”).

The parameter -Filter runs a simple query.

Listing all instances where the property Caption starts with “A”
Get-CimInstance -Class Win32_SerialPortConfiguration -Filter 'Caption LIKE "a%"' 
Using a WQL Query

The parameter -Query uses a query similar to SQL and combines the parameters -Filter and -Property. This returns all instances where the property Caption starts with “A”, and returns the properties specified:

Get-CimInstance -Query "SELECT DiscardNULLBytes, Caption, BaudRate, XOnXMitThreshold FROM Win32_SerialPortConfiguration WHERE Caption LIKE 'a%'"

Any property you did not specify is still present but empty. You might need to use Select-Object to remove all unwanted properties:

Get-CimInstance -Query "SELECT DiscardNULLBytes, Caption, BaudRate, XOnXMitThreshold FROM Win32_SerialPortConfiguration WHERE Caption LIKE 'a%'" | Select-Object -Property DiscardNULLBytes, Caption, BaudRate, XOnXMitThreshold

Accessing Remote Computers

To access remote systems, you need to have proper permissions. User the parameter -ComputerName to access one or more remote systems.

Authenticating as Current User
# one or more computer names or IP addresses:
$list = 'server1', 'server2'

# authenticate with your current identity:
$result = Get-CimInstance -ClassName Win32_SerialPortConfiguration -ComputerName $list 
$result
Authenticating as Different User

Use a CIMSession object to authenticate with a new identity:

# one or more computer names or IP addresses:
$list = 'server1', 'server2'

# authenticate with a different identity:
$cred = Get-Credential -Message 'Authenticate to retrieve WMI information:'
$session = New-CimSession -ComputerName $list -Credential $cred

$result = Get-CimInstance Win32_SerialPortConfiguration -CimSession $session

# remove the session after use (if you do not plan to re-use it later)
Remove-CimSession -CimSession $session

$result

Learn more about accessing remote computers.

Requirements

To use Win32_SerialPortConfiguration, the following requirements apply:

PowerShell

Get-CimInstance was introduced with PowerShell Version 3.0, which in turn was introduced on clients with Windows 8 and on servers with Windows Server 2012.

If necessary, update Windows PowerShell to Windows PowerShell 5.1, or install PowerShell 7 side-by-side.

Operating System

Win32_SerialPortConfiguration was introduced on clients with Windows Vista and on servers with Windows Server 2008.

Namespace

Win32_SerialPortConfiguration lives in the Namespace Root/CIMV2. This is the default namespace. There is no need to use the -Namespace parameter in Get-CimInstance.

Implementation

Win32_SerialPortConfiguration is implemented in CIMWin32.dll and defined in CIMWin32.mof. Both files are located in the folder C:\Windows\system32\wbem:

explorer $env:windir\system32\wbem
notepad $env:windir\system32\wbem\CIMWin32.mof