10-18-2026 02:50 AM
Dear NI Support Team,
I am currently developing a C# application to automatically detect and configure COM ports for NI communication cards.
Our system contains two NI PXIe-8431/16 (RS-485) communication cards, each installed in a different chassis slot and providing 16 serial ports.
I would like to know whether NI provides an API, SDK, or command-line interface that allows us to programmatically perform the following operations:
Detect all installed NI communication cards and identify their physical chassis slots.
Retrieve the serial ports associated with each communication card.
Configure or reassign COM port numbers for each card and its individual serial ports, similarly to the functionality available in NI-Serial or NI MAX.
Apply these configurations automatically without requiring manual interaction with NI MAX.
For example, I would like to assign COM7–COM22 to the first NI card and COM23–COM38 to the second card, while ensuring that each COM port is assigned to the correct physical device.
Is there an official NI-Serial API or another supported programming interface that allows this functionality?
If so, could you please provide the relevant documentation, API references, or code examples? Our preferred programming language is C#, but we are open to using C/C++, Python, or another language if necessary.
Thank you for your assistance.
Best regards,
Lior Buzaglo
10-18-2026 09:02 AM - edited 10-18-2026 09:12 AM
The generic API to detect NI hardware is called NI System Configuration API. There is a C interface, and the necessary headers and link libraries are installed at <ProgramFiles (x86)>\National Instruments\Shared\ExternalCompilerSupport\C when you enable "External Compiler Support" in the NI System Configuration Installer. This API is a bit particular as it uses an object model for the various hardware components with so called Experts that manage specific resources.
There is some documentation for how to use it in LabWindows/CVI, which is in large parts also relevant for the generic C API.
The NI Serial API header can be found in <ProgramFiles (x86)>\National Instruments\NI-Serial\niserial.h but that is not about detecting the NI serial hardware but rather about controlling NI proprietary extensions to the serial driver to control additional features (such as RS-485 modes etc) that the Windows COMM API does not cover.
Changing COM port assignment is however something that is handled by the Windows PnP system. You can access that probably through the SetupDI... APIs. That is however going to be a painful exercise as that API is very involved to get to the right resource.
Another option is to edit the registry where this information is actually stored. It's not trivial either as things are actually kind of sprinkled through several registry trees and vendor specific parts can be also involved but it generally all starts around HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM and from there you have other locations like HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\COM Name Arbiter and things under HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\ACPI, but it is all a bit of a relational database like structure with other possible locations.
10-18-2026 09:49 AM
Dear NI Support Team,
Thank you for the detailed explanation.
Based on your response, I understand that NI System Configuration can be used for hardware discovery, while COM port assignments are managed through Windows PnP.
My main requirement is to programmatically change the COM port bindings of two NI PXIe-8431/16 (RS-485) cards, each containing 16 serial ports.
For example:
Card in Slot 2: COM7–COM22
Card in Slot 3: COM23–COM38
I understand that NI MAX allows changing the COM Port Number through the Advanced Settings.
Could you please clarify whether this exact operation can be performed programmatically using Windows SetupAPI, a device-specific registry key, a driver IOCTL, or an NI-supported DLL function?
Specifically, I would like to know:
Which API or mechanism is used internally when NI MAX changes the COM Port Number and saves the Port Binding?
Does the NI PXIe-8431/16 driver support changing COM assignments through standard Windows SetupAPI mechanisms?
Is there a supported way to apply such changes without opening NI MAX or requiring manual interaction?
Is there any sample code in C/C++ or C# that demonstrates this operation?
My goal is to automate COM configuration while ensuring that each port is assigned to the correct physical card and slot.
Thank you for your assistance.
Best regards,
Lior
10-18-2026 10:33 AM - edited 10-18-2026 10:39 AM
I used to work for NI Switzerland as Application Engineer for about 5 years up to a little more than 30 years ago. So no, I'm not an NI support team member anymore for sure. This forum is nowadays run almost 100% by volunteer submissions only.
I gave you pointers to look further into but am not going to give you ready made answers on a presenting plate.
If you want direct answers from NI Support people you will have to use the appropriate support channels by submitting a support ticket. NI people are not monitoring these forums regularly and there is no mechanism in place that would alert them of any question on these forums. A few NI people monitor the most frequented forums such as the LabVIEW forums occasionally but only answer specific questions that they find themselves interesting to answer, but other forums get very little if any attention from NI support.