IT Agent is a lightweight agent you install on Windows, macOS, or Linux devices to scan them and send discovery data directly to Lansweeper Sites in the cloud. You can use the steps below to re-link an existing IT Agent installation to a new Lansweeper Site using a new linking code.
Prerequisites
Before you start, make sure:
- You can sign in to your Lansweeper Site (cloud) with permissions to manage Discovery systems.
- You have local administrator rights on the computer where Lansweeper IT Agent Discovery is installed.
- You can open and edit text files on that computer.
- You know that the default IT Agent folder on Windows is:
Program Files\Lansweeper IT Agent Discovery\itagent
If you need installation details for IT Agent, see the official guide:
Step-by-step instructions
1. Generate a new cloud token in Lansweeper Sites
- Sign in to your Lansweeper Site in the browser.
- Go to Discovery in the left menu.
- Click Link Discovery system.
- Generate a new token.
- Copy the token and keep it somewhere safe (you will paste it into a file in a later step).
2. Stop the IT Agent Windows service
On the computer where IT Agent is installed:
- Open Services (for example, press
Win + R, type services.msc, and press Enter).
- Find the service named IT Agent Discovery Service.
- Right-click it and select Stop.
3. Create the cloudtoken.txt file with the new token
- In File Explorer, browse to:
C:\Program Files\Lansweeper IT Agent Discovery\itagent
- In this folder, create a new text file named exactly:
cloudtoken.txt
- Open
cloudtoken.txt in a text editor (for example, Notepad).
- Paste the new cloud token into the file.
- Make sure there are no extra spaces or lines before or after the token.
- Save the file and close the editor.
4. Remove the old local hub database file
In the same folder:
- Still in
C:\Program Files\Lansweeper IT Agent Discovery\itagent, find the file:
hub.db
(this is the local database file the agent uses to store its link/configuration).
- Delete the file hub.db.
- This forces the agent to rebuild its local database and use the new token when it starts again.
5. Restart the IT Agent Windows service
- Go back to Services on the same computer.
- Find IT Agent Discovery Service again.
- Right-click it and select Start.
What happens now:
- The service reads the cloudtoken.txt file.
- It uses the new token to link to your Lansweeper Site.
- It recreates hub.db with fresh connection data.
- Once the link is successful, IT Agent automatically deletes
cloudtoken.txt for security.
This may take a short while (usually a few minutes).
6. Clean up duplicate Discovery systems in Lansweeper Sites
After the relink, Lansweeper Sites will see this as a new Discovery system with the same name as the old one:
- In Lansweeper Sites, go to:
Discovery → Discovery Systems → Agent based.
- You should now see two entries with the same name:
- One is the new, active IT Agent installation.
- The other is the old entry you no longer use.
- Click the old Discovery system entry.
- In the top-right corner of that page, click Delete.
- Confirm the deletion.
This keeps your Discovery Systems list clean and avoids confusion.
How to verify the relink worked
On the IT Agent machine:
- Check that the file
hub.db has been recreated in Program Files\Lansweeper IT Agent Discovery\itagent.
- Confirm that
cloudtoken.txt has disappeared from the same folder.
- Make sure IT Agent Discovery Service is Running in Services.
In Lansweeper Sites:
- Go to Discovery → Discovery Systems → Agent based.
- Verify that:
- The new Discovery system shows as online/healthy (status indicator).
- The Last seen or Last activity time updates after a short while.
- Optionally, check that assets scanned by this IT Agent appear in your Lansweeper Site as expected (for example, check last scan times on a known device).
If all these checks pass, your IT Agent installation is successfully linked to the new cloud token.
Related knowledge base articles
These articles provide additional background and installation details (they are not required for the relink steps above but can be useful):
Install IT Agent Discovery
Requirements and installation instructions for IT Agent Discovery on Windows, Linux, and macOS.
https://community.lansweeper.com/t5/cloud/install-it-agent-discovery/ta-p/67029
Set up and run Lansweeper IT Agent Discovery Portable
How to use the portable version of IT Agent for on-demand discovery.
https://community.lansweeper.com/t5/cloud/set-up-and-run-lansweeper-it-agent-discovery-portable/ta-p...