List Serial Port Configuration Properties


Enumerates configuration values for all the serial ports installed on a computer.


Supported Platforms

Windows Server 2003


Windows XP


Windows 2000


Windows NT 4.0


Windows 98



Script Code

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_SerialPortConfiguration")

For Each objItem in colItems
    Wscript.Echo "Abort Read Write On Error: " & objItem.AbortReadWriteOnError
    Wscript.Echo "Baud Rate: " & objItem.BaudRate
    Wscript.Echo "Binary Mode Enabled: " & objItem.BinaryModeEnabled
    Wscript.Echo "Bits Per Byte: " & objItem.BitsPerByte
    Wscript.Echo "Continue XMit On XOff: " & objItem.ContinueXMitOnXOff
    Wscript.Echo "CTS Outflow Control: " & objItem.CTSOutflowControl
    Wscript.Echo "Discard NULL Bytes: " & objItem.DiscardNULLBytes
    Wscript.Echo "DSR Outflow Control: " & objItem.DSROutflowControl
    Wscript.Echo "DSR Sensitivity: " & objItem.DSRSensitivity
    Wscript.Echo "DTR Flow Control Type: " & objItem.DTRFlowControlType
    Wscript.Echo "EOF Character: " & objItem.EOFCharacter
    Wscript.Echo "Error Replace Character: " & objItem.ErrorReplaceCharacter
    Wscript.Echo "Error Replacement Enabled: " & _
    Wscript.Echo "Event Character: " & objItem.EventCharacter
    Wscript.Echo "Is Busy: " & objItem.IsBusy
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Parity: " & objItem.Parity
    Wscript.Echo "Parity Check Enabled: " & objItem.ParityCheckEnabled
    Wscript.Echo "RTS Flow Control Type: " & objItem.RTSFlowControlType
    Wscript.Echo "Setting ID: " & objItem.SettingID
    Wscript.Echo "Stop Bits: " & objItem.StopBits
    Wscript.Echo "XOff Character: " & objItem.XOffCharacter
    Wscript.Echo "XOff XMit Threshold: " & objItem.XOffXMitThreshold
    Wscript.Echo "XOn Character: " & objItem.XOnCharacter
    Wscript.Echo "XOn XMit Threshold: " & objItem.XOnXMitThreshold
    Wscript.Echo "XOn XOff InFlow Control: " & objItem.XOnXOffInFlowControl
    Wscript.Echo "XOn XOff OutFlow Control: " & objItem.XOnXOffOutFlowControl



For online peer support, join the community on the news server. To provide feedback or report bugs in sample scripts or the Scripting Guide, please contact Microsoft TechNet.




This sample script is not supported under any Microsoft standard support program or service. The sample script is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.