How Can I Set The IP Address Programmatically in LabVIEW

Updated Jun 26, 2018

Reported In

Software

  • LabVIEW

Issue Details

Is it possible to set the IP address, Subnet Mask, and Default Gateway of my computer programmatically in LabVIEW?
 

Solution

You need to use the System Exec VI which invokes the command window. Right-click on the Block Diagram of a VI to show the Functions Palette and navigate to Connectivity»Libraries & Executables and place the System Exec VI on the block diagram. Right-click on the Command line input terminal of the System Exec VI and select Create Constant. In the created string constant, type the following arguments:

netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1

This will configure the connection named Local Area Connection to use static IP address 192.168.0.100, subnet mask 255.255.255.0 and DNS server 192.168.0.1 1.


 

Additional Information

Note.- In some cases, running the vi will not work due to Windows security permission. In order to workaround this security issue, Right-click Labview.exe and select Run as Administrator.
 

WAS THIS ARTICLE HELPFUL?

Not Helpful