Main example
List instances
# All instances of Win32_SerialPortConfiguration, with the main properties
Get-CimInstance -ClassName Win32_SerialPortConfiguration |
Select-Object -Property Name, Description, AbortReadWriteOnError, BaudRateExamples
Filter with WQL
# WQL filter evaluated by the provider: XOnXOffInFlowControl = 1 (TRUE)
Get-CimInstance -ClassName Win32_SerialPortConfiguration -Filter 'XOnXOffInFlowControl = 1' |
Select-Object -Property Name, Description, AbortReadWriteOnError, BaudRateThe filter is evaluated by the WMI provider: less data is transferred than with Where-Object.
Decode numeric values
# Lookup table for XOnXOffInFlowControl (values documented by Microsoft)
$xOnXOffInFlowControlName = @{
0 = 'FALSE'
1 = 'TRUE'
}
Get-CimInstance -ClassName Win32_SerialPortConfiguration |
Select-Object -Property @(
'Name'
'Description'
'AbortReadWriteOnError'
'BaudRate'
@{ Name = 'XOnXOffInFlowControl'; Expression = { $xOnXOffInFlowControlName[[int]$_.XOnXOffInFlowControl] } }
)Query a remote computer (CIM session)
review before running# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
Get-CimInstance -CimSession $cimSession -ClassName Win32_SerialPortConfiguration |
Select-Object -Property Name, Description, AbortReadWriteOnError, BaudRate
} finally {
Remove-CimSession -CimSession $cimSession
}WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.
Show the class structure
# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_SerialPortConfiguration
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, FlagsProperties
| Name | Type | Access | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AbortReadWriteOnError# | boolean | read | 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. Code | ||||||||||||||||||
| BaudRate# | uint32 | read | Baud (bits per second) rate at which the communications device operates. Example: 9600 Code | ||||||||||||||||||
| BinaryModeEnabled# | boolean | read | 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. Code | ||||||||||||||||||
| BitsPerByte# | uint32 | read | 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 Code | ||||||||||||||||||
| Caption# | string | read | Short textual description of the current object. Code | ||||||||||||||||||
| ContinueXMitOnXOff# | boolean | read | 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. Code | ||||||||||||||||||
| CTSOutflowControl# | boolean | read | 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. Code | ||||||||||||||||||
| Description# | string | read | Textual description of the current object. Code | ||||||||||||||||||
| DiscardNULLBytes# | boolean | read | If TRUE, NULL bytes (characters) are discarded when they are received. Code | ||||||||||||||||||
| DSROutflowControl# | boolean | read | 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. Code | ||||||||||||||||||
| DSRSensitivity# | boolean | read | 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. Code | ||||||||||||||||||
| DTRFlowControlType# | string | read | Use of the data terminal ready (DTR) flow control after a connection has been established. Values (3)
Code | ||||||||||||||||||
| EOFCharacter# | uint32 | read | Value of the character used to signal the end of data. Example: ^Z Code | ||||||||||||||||||
| ErrorReplaceCharacter# | uint32 | read | Value of the character used to replace bytes received with a parity error. Example: ^C Code | ||||||||||||||||||
| ErrorReplacementEnabled# | boolean | read | 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. Code | ||||||||||||||||||
| EventCharacter# | uint32 | read | Value of the control character that is used to signal an event, such as end of file. Example: ^e Code | ||||||||||||||||||
| IsBusy# | boolean | read | If TRUE, the serial port is busy. Code | ||||||||||||||||||
| Name# key | string | read | Name of the Windows serial port. Example: "COM1" Code | ||||||||||||||||||
| Parity# | string | read | 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. Values (5)
Code | ||||||||||||||||||
| ParityCheckEnabled# | boolean | read | If TRUE, parity checking is enabled. Code | ||||||||||||||||||
| RTSFlowControlType# | string | read | Request to send (RTS) flow control. RTS is used to signal that data is available for transmission. Values (4)
Code | ||||||||||||||||||
| SettingID# | string | read | Identifier by which the current object is known. Code | ||||||||||||||||||
| StopBits# | string | read | 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. Values (3)
Code | ||||||||||||||||||
| XOffCharacter# | uint32 | read | 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. Code | ||||||||||||||||||
| XOffXMitThreshold# | uint32 | read | Maximum number of bytes allowed in the input buffer before the XOFF character is sent. Code | ||||||||||||||||||
| XOnCharacter# | uint32 | read | 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. Code | ||||||||||||||||||
| XOnXMitThreshold# | uint32 | read | 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. Code | ||||||||||||||||||
| XOnXOffInFlowControl# | uint32 | read | 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. Values (2)
Code | ||||||||||||||||||
| XOnXOffOutFlowControl# | uint32 | read | 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. Code |
Remarks
The Win32_SerialPortConfiguration class is derived from CIM_Setting.
Inheritance
Superclass chain
- CIM_Setting
- Win32_SerialPortConfiguration
Known subclasses
No known subclass.
Requirements
- Namespace
- root/cimv2
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- Provider
- CIMWin32
- MOF file
- CIMWin32.mof
- DLL
- CIMWin32.dll
Class qualifiers
Dynamic Provider("CIMWin32") UUID("{8502C4EB-5FBB-11D2-AAC1-006008C78BC7}") AMENDMENT
Microsoft source
Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.