Archived:Running a LabVIEW Application as a Windows XP/Server 2003 User-Defined Service

Updated Jun 13, 2023

NI does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.

Environment

Software

  • LabVIEW

Operating System

  • Windows

Other

  • Windows XP
  • Windows Server 2003

How can I run a LabVIEW Application as a Windows XP/Server 2003 User-Defined Service?

Note: The following solution requires editing of the Windows Registry. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. You should always back up the Registry before editing it.

The Windows Server 2003 Resource Kit Tools are required for creating a user-defined service -- download them and follow the standard installation process.

Once the kit is installed, follow the steps below (they can also be found in more detail at How to Create a User-Defined Service):
  1. From the command prompt, call the instsrv utility providing two parameters: service name and srvany.exe file path, as follows:
    • instsrv "My Service" "%Resource Kit%\Tools\srvany.exe", where My Service is the name of the service you are creating, and the path %Resource Kit% is the fully-qualified path to the Windows Resource Kit.
      • The default location of the Windows Resource Kit is typically C:\Program Files\Windows Resource Kit.
  2. Open the Registry and locate the following subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%My Service%
  3. Create a new Key named Parameters.
  4. Create the following new Value within the Parameters key:
    • Value Name: Application
    • Data Type: REG_SZ
    • String: %Application Path%, where %Application Path% is the fully qualified path to the application executable including the extension.
  5. Close the Registry.

Additional Information

The Windows Server 2003 Resource Kit Tools provide two utilities that allow you to create a user-defined service for Windows applications. One is instrsrv.exe, which installs and removes system services from Windows, and the other is srvany.exe, which allows any Windows application to run as a service.

By default, a newly created service is configured to run automatically when the system is restarted. Also, services do not have user interfaces, so your application must run without direct interaction on the front panel. You can still control the applications using methods like VI Server or network communication. Install Application as Windows Service is an example that will automate this process for you.