1. Home
  2. Help Topics
  3. Manage your Domotz Agent installation, uninstall, and activation via Command Line

Manage your Domotz Agent installation, uninstall, and activation via Command Line

Install Windows Domotz Agent via scripting

It is possible to install and configure the Domotz Agent on Windows OS silently. In this way, the installation and configuration of the Domotz Agent on Windows can be included in a script that can be executed remotely via traditional RMM solutions for end-point.

The installation of the Domotz Agent in a silent mode can be achieved by executing the following command from an Administrator command-line shell:  

domotz_agent_installer.exe /S /D=%DOMOTZ_BASE_DIR%

Once the Domotz Agent has been installed on your Windows machine,.

Install Domotz Agent via scripting

The following Powershell script provides an example of usage of the above instruction. If it is executed with Administrator privileges on a Windows machine, it will:

  • Download the latest version of the Windows Domotz Agent.
  • Silently install the Domotz Agent on the machine.
  • Configure and activate it using the Agent Activation API Key under your account.

https://raw.githubusercontent.com/domotz/support_scripts/main/windows_install_scripts/src/windows_agent_installation_and_activation_script.ps1

Once downloaded please edit it and set the following variables:

$AgentName: this is the name of the Agent that you are willing to configure and activate

$ActivationKey: this is your personal Agent Activation API Key

$ApiEndpoint: this is the Base URL API Endpoint as reported at the time of the creation of the Agent Activation API Key and in the Portal (under Settings - API Key section)

The script assumes that it is executed on the same Windows machine where you are planning to install and configure the Domotz agent, and can be used fn external RMM solutions (ConnectWise Automate, Datto RMM, Syncro, Ninja RMM, Atera, etc) to remotely install, configure and activate new Domotz Agent at your customers’ sites.

Uninstall the Domotz Windows Agent Silently

The uninstall of the Domotz Agent in a silent mode can be achieved by executing the following command from an Administrator command-line shell:  

uninstall.exe /S /D=%DOMOTZ_BASE_DIR%

Or might use this script which should be run in an Administrative mode Powershell:

https://raw.githubusercontent.com/domotz/support_scripts/main/windows_install_scripts/src/domotz_win_cmdline_uninstall.ps1

Agent Activation via Cmd line

A new Domotz Agent can be activated and configured directly via command line (or API) by using an Agent Activation API Key.

Every Domotz Agent, starting from version 3.3.0, listens on port 3000 (http) with a new end-point which can be used to activate and configure it.

You can use this automatic script on Windows:

For users in the United States of America:
https://github.com/domotz/support_scripts/blob/main/windows_install_scripts/domotz_win_cmdline_activation_us.zip

For users which reside in other countries:

https://raw.githubusercontent.com/domotz/support_scripts/main/windows_install_scripts/src/domotz_win_cmdline_activation_eu.ps1

Or you can manually perform the following command will configure and activate a new agent:

curl -v  -XPOST -H "x-api-key: ${X_API_KEY}" -d "{\"name\": \"${AGENT_NAME}\", \"endpoint\": \"${DOMOTZ_PUBLIC_ENDPOINT}\"}" http://${DOMOTZ_AGENT_IP}:3000/api/v1/agent

Please, configure X_API_KEY, NAME, ENDPOINT and DOMOTZ_AGENT_IP address for your actual scenario. For instance, you can use something like:

X_API_KEY="your-agent-api-key"
AGENT_NAME="your-agent-name"
DOMOTZ_PUBLIC_ENDPOINT="https://api-testing-eu-central-1-cell-1.domotz.nl/public-api/v1/"
DOMOTZ_AGENT_IP="10.10.10.125"

Note: the minimum version of the Agent required is 3.3.0.
You can check the version of your agent with the following API call to the Agent itself:

curl -v -XGET http://${DOMOTZ_AGENT_IP}:3000/api/v1/status

Check for agent_version in the returned json. Also, you can check if the Agent is not yet configured it is mode=RESTRICTED.

Please, refer to section Windows OS with a practical example of how to install and configure a Domotz Agent silently and via script.

Activation with Network Scanning Disabled

Starting from version 3.9.3 the agent can be activated passing an additional optional boolean field “deny_all_interfaces” in the request body. If true, the agent will not scan any network unless a specific “allow” configuration is passed using the Set Network Interfaces Policy method of the Public-API:

curl -v  -XPOST -H "x-api-key: ${X_API_KEY}" -d "{\"name\": \"${AGENT_NAME}\", \"endpoint\": \"${DOMOTZ_PUBLIC_ENDPOINT}\", \"deny_all_interfaces\": true}" http://${DOMOTZ_AGENT_IP}:3000/api/v1/agent

Updated on November 25, 2022

Was this article helpful?