Link on Windows

When running the Link Agent on a Windows machine we recommend following the steps below to ensure the most reliable Link Agent configuration.

Install Java

The Link Agent runs on Java and requires at least Java 9 or newer to be installed on the machine. We recommend installing Java 11. First, download and install the Java 11 JDK for Windows. The .msi installer is usually the easiest option.

Configure Java

It may be necessary to set the JAVA_HOME environment variable if the installer did not do this. First, edit the system environment variables:

373 411

If JAVA_HOME does not appear under System variables, we'll need to add it, and the Path variable will also need to be adjusted.

🚧

System variables vs user variables

When adding/editing variables, ensure that you are doing so under the System variables section toward the bottom of the Environment Variables window, not the User variables for... section at the top.

Click the New... button, enter JAVA_HOME as the variable name, and click the Browse Directory... button. Navigate to the location where Java was installed. This path is usually under C:\Program Files\Java. Choose the directory starting with jdk-, for example jdk-11.0.2.

747

Click the OK button, and verify that the JAVA_HOME variable is present under System variables

621

Next, select the Path variable, and click the Edit... button

621

Click the New button, and enter %JAVA_HOME%\bin. Click the OK button.

527

Click OK on the Environment Variables and System Properties windows.

Verify Java configuration

Open a command prompt

368

Enter the command java -version, and verify that you see output similar to the following image:

983

Note that the specific version of java may differ depending on what the latest version was when you installed it.

Extract and run the Link Agent

In the same command prompt, navigate to the directory where you downloaded the Link Agent (link-agent.zip), and extract the archive using the following command:

powershell.exe -NoP -NonI -Command "Expand-Archive link-agent.zip"

Next, cd into the link-agent\link-agent directory, and execute the Link Agent script to verify that the Link Agent can run. Without any command-line arguments the Link Agent should print some help documentation and exit.

cd link-agent\link-agent
bin\link-agent
983

Next, try running the Link Agent with the minimum required arguments:

  • Your API key (-a)
  • A unique agent name (-n)

Running the Link Agent as a Windows service

Once you have verified that the Link Agent is working, we recommend creating a Windows service for the Link Agent so that it will continue running in the background even if you lock the screen or log out.

📘

Install NSSM

In order to install the LinkAgent as a system service you will need to first install a helper program called NSSM. Download NSSM from here, and extract the 64-bit version of the executable to a location on your path. You can create a separate directory for this executable such as C:\nssm and add that directory to your path, or you can copy the executable to a directory that is already on your path such as C:\windows.

The next step is to take your full Link Agent command, (including API key, agent name, and any other parameters), and save it to a separate .bat script. The script should contain the absolute path to the Link Agent. Below is an example of what this script might look like if you have followed previous examples in this guide:

C:\mabl\link-agent\link-agent\bin\link-agent -a <your-api-key-here> -n <your-link-agent-name-here>

🚧

Specify the absolute path to the link-agent executable

Remember to specify the absolute path to the Link Agent in your wrapper script. This path should start with a drive letter, such as C:\

Save this file to a well known location, such as C:\mabl\link-agent-wrapper.bat. Next, open a command prompt as an administrator:

689

Create a service for the Link Agent using NSSM, substituting in the path where you have created your wrapper script, and then start the new service:

nssm install LinkAgent C:\mabl\link-agent-wrapper.bat
nssm start LinkAgent

🚧

Specify the absolute path to the wrapper script

Remember to specify the absolute path to the wrapper script when executing the nssm install command. This path should start with a drive letter, such as C:\

The LinkAgent service can be configured to run on startup if you wish, or you can start it manually via the nssm start command.