Remove Old VISA Resources from NI MAX and LabVIEW

Updated Mar 8, 2024

Environment

Software

  • Measurement & Automation Explorer (MAX)
  • LabVIEW

Driver

  • NI-VISA

When I use a VISA Resource Name constant in LabVIEW or the VISA Aliases Editor in Measurement & Automation Explorer (MAX), there are some resources listed that are no longer present in my computer, such as serial ports that I had previously installed.
  • Is there a way I can delete the obsolete VISA resource names?
  • Is there a way to remove VISA aliases programmatically?

There are two methods for deleting old VISA resources: 
  • Deleting the alias through the VISA Alias Utility in NI MAX. This method is for newer versions of NI-VISA.
  • Deleting the alias by modifying the visaconf.ini file. This method is for older versions of NI-VISA.
 

Deleting Through the NI MAX VISA Alias Utility 

  1. In NI MAX, navigate to Tools»NI-VISA»VISA Options
  2. Select Aliases in the General Settings to view a list of resources and aliases on your system. From this panel, you can rename, add, or clear aliases.
  3. To remove a single alias, right-click on the resource and select Clear Alias.

Modifying the visaconf.ini File

  1. Access the visaconf.ini file on your system. The default directory for visaconf.ini is dependent on your operating system:
  • Windows XP: <Documents and Settings>\All Users\Application Data\National Instruments\NIvisa
  • Windows Vista or 7: <ProgramData>\National Instruments\NIvisa
  • Windows 10/11:<ProgramData>\National Instruments\NIvisa
  1.  To delete resource names individually:
    1. Delete the appropriate alias from the visaconf.ini file
    2. Close and reopen LabVIEW (when using a VISA Resource Name Constant)
    3. Refresh MAX by pressing F5 (when using the VISA Aliases Editor)
  2. To delete all VISA resources not currently installed on the computer:
    1. Delete visaconf.ini entirely
    2. Refresh MAX. Refreshing MAX will create a new visaconf.ini file
Note: Closing and reopening LabVIEW will not create a new visaconf.ini file.
 

Remove VISA Aliases Programmatically

  1. You can use the System Configuration API (Measurement I/O palette >> System Configuration) to find all available hardware resources connected to the system, see which of them are actually present, and then delete the ones that are not. 

Additional Information

Below is an example on how to remove resources ASRL2::INSTR and ASRL3::INSTR in visaconf.ini: 

Replace this: 
[ALIASES]
Alias0 = "'LPT1','ASRL10::INSTR'"
Alias1 = "'COM1','ASRL1::INSTR'"
Alias2 = "'COM2','ASRL2::INSTR'"
Alias3 = "'COM3','ASRL3::INSTR'"
NumAliases = 4

[ASRL-RSRC-ALIAS]
Name0 = "ASRL10::INSTR"
Enabled0 = 1
Static0 = 1
SystemName0 = "LPT1"
BaudRate0 = 9600
DataBits0 = 8
Parity0 = 0
StopBits0 = 10
FlowCtrl0 = 0
Name1 = "ASRL1::INSTR"
Enabled1 = 1
Static1 = 0
SystemName1 = "COM1"
BaudRate1 = 9600
DataBits1 = 8
Parity1 = 0
StopBits1 = 10
FlowCtrl1 = 0
Name1 = "ASRL2::INSTR"
Enabled1 = 1
Static1 = 0
SystemName1 = "COM2"
BaudRate1 = 9600
DataBits1 = 8
Parity1 = 0
StopBits1 = 10
FlowCtrl1 = 0
Name1 = "ASRL3::INSTR"
Enabled1 = 1
Static1 = 0
SystemName1 = "COM3"
BaudRate1 = 9600
DataBits1 = 8
Parity1 = 0
StopBits1 = 10
FlowCtrl1 = 0
NumOfResources = 4

with this: 
[ALIASES]
Alias0 = "'LPT1','ASRL10::INSTR'"
Alias1 = "'COM1','ASRL1::INSTR'"
NumAliases = 2

[ASRL-RSRC-ALIAS]
Name0 = "ASRL10::INSTR"
Enabled0 = 1
Static0 = 1
SystemName0 = "LPT1"
BaudRate0 = 9600
DataBits0 = 8
Parity0 = 0
StopBits0 = 10
FlowCtrl0 = 0
Name1 = "ASRL1::INSTR"
Enabled1 = 1
Static1 = 0
SystemName1 = "COM1"
BaudRate1 = 9600
DataBits1 = 8
Parity1 = 0
StopBits1 = 10
FlowCtrl1 = 0
NumOfResources = 2

Note: Before NI-VISA 4.2, the default director of visaconf.ini was C:\VXIpnp\WinNT\NIvisa 
Note: See Remove VISA Aliases Programmatically for an example VI.