Finding a Computer Name Programmatically with LabVIEW

Updated Dec 18, 2023

Reported In

Hardware

  • CompactRIO Controller
  • PXI Controller

Software

  • LabVIEW Full
  • LabVIEW Base

Issue Details

How do I use LabVIEW to determine the name of my computer?

Solution

To determine the computer name, you can use the String to IP and IP to String functions from the TCP palette. To return the IP address of the local machine, do not wire the name input terminal of the String to IP function. Connect the net address output of String to IP to the net address input of the IP to String function as shown below. 

You can also use the System Configuration API. The VI called Find Hardware.vi will return the computer name and IP address not only for the PC that runs the code but for any other NI system on the same network. The example Show All Hardware.vi located at C:\Program Files (x86)\National Instruments\LabVIEW 2018\examples\nisyscfg shows this functionality. Most of System Configuration VIs are able to run on Windows and Real-Time OS. More information can be found on the related links.