Skip to content

Conversation

@stephannn
Copy link
Contributor

@stephannn stephannn commented Oct 13, 2025

Hi,
I made a new pull request about duplicated nodes with the same name in MeshCentral. When the property preventDuplicateDevices is set to true and an agent tries to register with an existing name again, the old node gets removed and the new one added.
Please let me know what you think

Edit: #6990

@DaanSelen
Copy link
Contributor

I propose a git commit squash

@si458
Copy link
Collaborator

si458 commented Oct 23, 2025

We discussed this at the meeting, we are going to have a think.
Only reason being someone brought up the issue of what happens to all the old devices history?
So its power status, the events etc, they would all get deleted :(
So just a rethink for the moment!

Edit: maybe we could do a nodeid replace across the database!?

@stephannn
Copy link
Contributor Author

We discussed this at the meeting, we are going to have a think. Only reason being someone brought up the issue of what happens to all the old devices history? So its power status, the events etc, they would all get deleted :( So just a rethink for the moment!

Edit: maybe we could do a nodeid replace across the database!?

it was also about some plugins?!?

I am very new to MeshCentral, but I noticed, now the burner, it has not a real relation db schema. Every information is just stored in a JSON in a doc. So to do a replace, every JSON has to be analyzed. Tomorrow I will take a look again at the DB.

Besides, it is just an option that can be chosen, it is not forced. But yes, I am welcomed for ideas and I will take a look what I can do.

A further question. I had to change the main function to async, because I had trouble receiving the value from the DB without. In case no one has seen it ;)

@si458
Copy link
Collaborator

si458 commented Oct 23, 2025

@stephannn yes the plugins was a sudden brain wave I had in my mind.

For example the script task plugin has its own database

But it stores information like nodeid ran this command

This command is run on against that node

If the node suddenly got deleted

The plugin would be like WTF where's the node gone?

But indeed your unique case as u explained about the AD made a valid point! So the hostnane would always be unique etc so its easy to clean up etc and u wasn't too bothered about history etc!!!

Im thinking of maybe merging it but adding a disclaimer in the schema and also displaying a warning in the my server page so if they enable it they know that old information will be permanently deleted when the device reconnects etc with a new node id etc :) (brain wave im just having now haha)

@stephannn
Copy link
Contributor Author

@si458 , I took a look again and I think I can add an update for the table power to replace the nodeid with the new one. However, I still have two question. I think when an agent registers, it does not transfer der BIOS ID to check if the new node with the same hostname is really the same device that is going to be replaced. This information will just be in the sinode doc later on.
The other point is, I think I can also add a function that moves old duplicate devices to a different mesh when configured, instead of deleting. Not sure what do you think

@DaanSelen
Copy link
Contributor

What is the current status of:
Condition -> Action?

@stephannn
Copy link
Contributor Author

Sorry for letting the topic fade away a bit. I made following process (no real process language) to check if a device exists:
image

It has basically two variables: AvoidDuplicates and MoveDuplicates
If the first is set to true, the process will start, otherwise, nothing will change to the current setup. The second variable will move a duplicate device to another mesh if specified. So that maybe only admins still can see the device, but other IT agents wont.
I also thought about a BIOS Serial check, but Simon explained me that this is more an enterprise feature. Consumer hardware does not have a serial and it will be null. However, this would also require a change in the agent because currently on the first contact, the BIOS SN is not transmitted. In my opinion I still would love this, because even when you are in a Windows domain and can only have unique names, sometimes a device just resets the name of another device. The old device is of course not a member of the domain anymore, but at least you still would see this in MeshCentral.

Besides, a function to move a client in the meshagent.js seems to be missing.

Maybe we can discuss this in the next monthly meeting.

@silversword411
Copy link
Contributor

For all those TPM2 machines out there aka win11+

Get-TpmEndorsementKeyInfo

Will give you an unchangeable tracking SN.

You don't think that's abused by people wanting to track you...do you?

@stephannn
Copy link
Contributor Author

Another idea we had in the monthly meeting:
The client initially sends TPM, BIOS-SN, MAC and on the server site these values are evaluated based on existence and priority. Also we have to check nicknames, when a client name was changed in the view

What I don't understand, why there exists duplicates out of nothing. the node-ID on the client in the MeshAgent.db should be the same?!?

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jan 28, 2026
@DaanSelen
Copy link
Contributor

Ongoing @si458 should we increase PR stale marks?

@github-actions github-actions bot removed the Stale label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants