> For the complete documentation index, see [llms.txt](https://docs.thousandeyes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents/installing/windows/reinstall-the-endpoint-agent.md).

# Reinstall the Endpoint Agent on Windows

To address scenarios that require the agent to be reinstalled, use the reinstallation process to preserve historical data, alert configurations, labels, tests, and proxies. Reinstallation also ensures that you do not consume an additional license.

When you initiate reinstallation, ThousandEyes checks for an existing agent with the same hostname. If an agent is found, the new agent merges with the existing agent and acquires its identity and hostname. If no agent with the same hostname is found, a new agent is created and consumes a new license.

{% hint style="info" %}
Reinstalling a disabled agent consumes a license if an unused license is available.
{% endhint %}

## Generate the Reinstallation Key

To reinstall an agent, you must have the **reinstallation key**. This key is unique for every account group.

1. In the ThousandEyes web application, navigate to **Endpoint Experience > Agent Settings**.

![](/files/OcOZ09wecNts4A1VuPfH)

2. Click **Regenerate New Key**.
3. Save the new reinstallation key locally. The key cannot be retrieved later. To see a key in plain text, regenerate it (which revokes any previous keys).

The reinstallation key is unique for every account group and applies to all users in the account group until regenerated.

## Reinstall on Windows

Add the following parameters to the installer:

* `ENDPOINT_REINSTALLATION_METHOD`
* `ENDPOINT_REINSTALLATION_KEY`

Example:

`msiexec.exe /i <path_to_msi> /quiet /norestart ACCOUNT_CONFIG="<connection_string>" ENDPOINT_REINSTALLATION_METHOD=MERGE_BY_HOSTNAME ENDPOINT_REINSTALLATION_KEY="<reinstallation_key>"`

`MERGE_BY_HOSTNAME` is the only valid option to trigger the reinstallation flow in the installer.

For reinstallation via Group Policy, see [Guidance for Windows Software Deployment Teams](/product-documentation/global-vantage-points/endpoint-agents/installing/windows/guidance-for-windows-software-deployment-team.md#agent-reinstallation).

## Error Handling

If the reinstallation key or reinstallation method is invalid during registration, the system returns HTTP 200 with a special status indicating that a token was invalid.

For the connection string used during registration, see [Endpoint Agent Installation Reference for Windows](/product-documentation/global-vantage-points/endpoint-agents/installing/windows/endpoint-agent-installation-reference.md#connection-string).
