Example Code

Programmatically Reading Serial Number of VISA Devices and Resources in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.



Code and Documents




This document explains how to programmatically read the serial number of a device which is supported by the NI-VISA driver.


It is possible to extract a device's serial number using a VISA property node.  The property to use is the Interface Information:Interface Description property.   This property returns a string with a description of the device referred to by the VISA session.  For example, the string returned for an NI-USB-485 is ASRL3 (COM10 - NI USB-485/1 SN:XXXXXX, Communications Port), where XXXXXX is the serial number of the device. You can parse this string to use any of the information in your application. The attached VI parses the string to isolate the serial number.



Note: The VISA attribute Interface Information:Interface Description is device-dependent. COM ports will not have a serial number. The serial number will appear as it does in NI Measurement & Automation Explorer (MAX). If NI MAX does not display the serial number, then this property node will not work. In that case, please refer to the device's manual for accepted commands to the instrument.


Additional Resources

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.