Programmatically Start or Stop Windows Services from LabVIEW

Updated Sep 19, 2018

Reported In

Software

  • LabVIEW

Operating System

  • Windows

Issue Details

I want to stop or start a Windows Service, such as the NI Variable Engine, from my LabVIEW application.

Solution

There are no specific LabVIEW VIs that control the Window Services. In order to stop or start a service, the System Exec VI can be used in conjunction with the correct command line call. The command line argument is wired into the Command Line input terminal of the System Exec VI as shown in the figure below.

 For example, to start the NI Variable Engine, type the following in the input string terminal: 

net start "NI Variable Engine" 

Note: Prior to LabVIEW 2012, NI Variable Engine is listed as National Instruments Variable Engine in Windows Services.

Additional Information

Starting and stopping services requires administrator privileges. You must run LabVIEW as an administrator in order for this command to work.

You can find the correct name of the service that you want to start or stop by opening Services from the Start menu.