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

2 min

You can install and configure the Domotz Agent on Windows OS silently. Doing so means you can include the Domotz Agent on Windows in a scrpt which you can execute, install and configure remotely using an RMM solution for end-points.

You can achieve the Domotz Agent installation in silent mode by executing the following command from an Administrator command-line shell:  

domotz_agent_installer.exe /S /D=%DOMOTZ_BASE_DIR%

Follow the next steps, once you install the Domotz Agent on your Windows machine.

Install Domotz Agent via scripting

The following PowerShell script provides an example using the instructions above. If you execute the following with Administrator privileges on a Windows machine, it will:

Once download is complete 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)

Please see here how to get your Activation Key: https://help.domotz.com/user-guide/domotz-api/

The script assumes you execute it on the same Windows machine where you are planning to install and configure the Domotz agent. Additionally, you can use it for external RMM solutions (ConnectWise Automate, Datto RMM, Syncro, Ninja RMM, Atera, etc) to remotely install, configure and activate new Domotz Agents at your customer sites.

You can achieve the uninstall of the Domotz Agent in silent mode by executing the following command from an Administrator command-line shell:  

uninstall.exe /S /D=%DOMOTZ_BASE_DIR%

Or you can 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

This next section covers Domotz Agent Activation via Command line. You can activate and configure a new Domotz Agent 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) which you can use to activate and configure it.

Use this automatic script on Windows:

https://github.com/domotz/support_scripts/blob/main/windows_install_scripts/src/windows_agent_installation_and_activation_script.ps1

Use the following to activate the agent using Linux:

1. Declare the variables accordingly with your scenario:

X_API_KEY="HFHZOeVieW7U0ixQvJ1c"
AGENT_NAME=""
DOMOTZ_PUBLIC_ENDPOINT="https://api-eu-west-1-cell-1.domotz.com/public-api/v1/"
DOMOTZ_AGENT_IP="10.0.0.1"

2. Activate the agent with the following curl:

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

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.

Starting from version 3.9.3 you can activate an agent 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

You might find a poweshell script to activate an agent with Network Scanning Disabled on Windows here: https://github.com/domotz/support_scripts/blob/main/windows_install_scripts/src/windows_agent_installation_and_activation_script_scanning_disabled.ps1

Share via Social Networks

You might also like…

Read more top posts in this category

Want more tips on Network Monitoring?

Ready to get started with Domotz?

  • Powerful
  • Automated
  • Simple
  • Affordable
Start Your Free Trial Contact Sales