Win32_SerialPortConfiguration jscript sample code
The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).
ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_SerialPortConfiguration WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Description
The Win32_SerialPortConfiguration WMI class represents the settings for data transmission on a Windows serial port. This includes configurations for establishing a connection and error checking.
Sample Code
var wbemFlagReturnImmediately = 0x10; var wbemFlagForwardOnly = 0x20; var arrComputers = new Array("DELL17"); for (i = 0; i < arrComputers.length; i++) { WScript.Echo(); WScript.Echo("=========================================="); WScript.Echo("Computer: " + arrComputers[i]); WScript.Echo("=========================================="); var objWMIService = GetObject("winmgmts:\\\\" + arrComputers[i] + "\\root\\CIMV2"); var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SerialPortConfiguration", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); var enumItems = new Enumerator(colItems); for (; !enumItems.atEnd(); enumItems.moveNext()) { var objItem = enumItems.item(); WScript.Echo("AbortReadWriteOnError: " + objItem.AbortReadWriteOnError); WScript.Echo("BaudRate: " + objItem.BaudRate); WScript.Echo("BinaryModeEnabled: " + objItem.BinaryModeEnabled); WScript.Echo("BitsPerByte: " + objItem.BitsPerByte); WScript.Echo("Caption: " + objItem.Caption); WScript.Echo("ContinueXMitOnXOff: " + objItem.ContinueXMitOnXOff); WScript.Echo("CTSOutflowControl: " + objItem.CTSOutflowControl); WScript.Echo("Description: " + objItem.Description); WScript.Echo("DiscardNULLBytes: " + objItem.DiscardNULLBytes); WScript.Echo("DSROutflowControl: " + objItem.DSROutflowControl); WScript.Echo("DSRSensitivity: " + objItem.DSRSensitivity); WScript.Echo("DTRFlowControlType: " + objItem.DTRFlowControlType); WScript.Echo("EOFCharacter: " + objItem.EOFCharacter); WScript.Echo("ErrorReplaceCharacter: " + objItem.ErrorReplaceCharacter); WScript.Echo("ErrorReplacementEnabled: " + objItem.ErrorReplacementEnabled); WScript.Echo("EventCharacter: " + objItem.EventCharacter); WScript.Echo("IsBusy: " + objItem.IsBusy); WScript.Echo("Name: " + objItem.Name); WScript.Echo("Parity: " + objItem.Parity); WScript.Echo("ParityCheckEnabled: " + objItem.ParityCheckEnabled); WScript.Echo("RTSFlowControlType: " + objItem.RTSFlowControlType); WScript.Echo("SettingID: " + objItem.SettingID); WScript.Echo("StopBits: " + objItem.StopBits); WScript.Echo("XOffCharacter: " + objItem.XOffCharacter); WScript.Echo("XOffXMitThreshold: " + objItem.XOffXMitThreshold); WScript.Echo("XOnCharacter: " + objItem.XOnCharacter); WScript.Echo("XOnXMitThreshold: " + objItem.XOnXMitThreshold); WScript.Echo("XOnXOffInFlowControl: " + objItem.XOnXOffInFlowControl); WScript.Echo("XOnXOffOutFlowControl: " + objItem.XOnXOffOutFlowControl); } }