# Using remote control with agent

The [Agent](https://github.com/duplicati/documentation/blob/main/detailed-descriptions/duplicati-programs/agent.md) is designed to be deployed in a way that is more secure and easier to manage at scale than the regular [TrayIcon](https://github.com/duplicati/documentation/blob/main/detailed-descriptions/duplicati-programs/trayicon.md) or [Server](https://github.com/duplicati/documentation/blob/main/detailed-descriptions/duplicati-programs/server.md) instances. When the agent is running, it does not have any way to interact with it from the local machine.

{% hint style="info" %}
The Agent is only available on the Enterprise plan
{% endhint %}

On the very first run, the Agent will attempt to register itself with the Duplicati Console. If there is a desktop environment and a browser on the system, the Agent will attempt to open this with [the registration link](/automation-and-integration/using-remote-management.md#registering-on-the-console). In case there is no such option, the Agent will print out the link in the console or Event Viewer on Windows. The Agent will repeatedly poll the Console to find out when it is claimed.

As long as the Agent is not registered, restarting it will make it attempt to connect again.

Once the agent is registered, it immediately enables the connection and will be listed as a registered machine in the [portal settings](https://app.duplicati.com/app/settings/registered-machines).

<figure><img src="/files/mcFfRqMTcf14svsl3KXB" alt="" width="375"><figcaption><p>The machine is registered</p></figcaption></figure>

## Simplified registration

To skip the registration step and have the agent connect directly to the console without any user intervention, it is required to first create a link that is pre-authorized on the Console. To do this head to the [portal settings](https://app.duplicati.com/app/settings/registered-machines) and click the "Add registration url" button.

<figure><img src="/files/Y6VnpVlli8KKXlHwIWTw" alt="" width="375"><figcaption><p>Added a registration URL</p></figcaption></figure>

Any machine can now use this pre-authorized url to add machines to your organization in the Console. You can click the "Copy" button to get the link to your clipboard and paste it in when registering a machine. Do not share this link with anyone as it could allow them to add machines to your account.

To revoke a link, simply delete it from within the portal. This will prevent new machines from registering, but existing registered machines will remain there.

With the registration link, start the Agent with a commandline such as:

```sh
duplicati-agent --registration-url=<copied-url>
```

This will cause the Agent to immediately show up in the Console. Future invocations of the agent will not require the registration url, but should the Agent somehow be de-registered, it will re-reregister if the url is set and the link is still valid.

### Registration with deployment

To simplify starting the agent in larger scale deployments, it is possible to configure [a `preload.json`file](/configuration-and-management/preload-settings.md) with the registration url.

{% hint style="success" %}
There is a button on the [Links page in the console](https://app.duplicati.com/app/machines/links) to download the file with the link inserted so you do not have to create the file manually. Using the generated file is recommended as it reduces the chance for typo errors.
{% endhint %}

To create a preload file manually, create a new file named `preload.json`with the following content:

```json
{
  "args": {
    "agent": [ "--registration-url=<copied-url>" ],
  },
  "env": {
    "*": {
      "DUPLICATI__REGISTER_REMOTE_CONTROL": "<copied-url>"
    }
  }
}
```

{% hint style="info" %}
The first part in the example affects only the [Agent](/duplicati-programs/agent.md), the second parts sets the environment variable for the [TrayIcon](/duplicati-programs/trayicon.md) and [Server](/duplicati-programs/server.md) configurations.
{% endhint %}

This file can then be distributed to the target machine before the package is installed. The [preload settings page](/configuration-and-management/preload-settings.md) describes the possible locations where Duplicati will look for such a file.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.duplicati.com/automation-and-integration/using-remote-management/using-remote-control-with-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
