Get the Device-ID when on Agent #4369

Closed
opened 2026-02-20 09:24:50 -05:00 by deekerman · 4 comments
Owner

Originally created by @prononext on GitHub (Jun 19, 2023).

Dear MeshCentral Fans,

does anyone know how to get the device ID when I am on a agent (Windows + Unix)?

The node ID of the group/mesh I can get with "$filepathtomyagent -nodeid" but I need the deviceid.

Background is that I want to automate some actions and notifications via meshctrl and to directly communicate with the device from the agent or another host I need to get the deviceid.

I am happy for any hint on this topic.

Have a great day.

Originally created by @prononext on GitHub (Jun 19, 2023). Dear MeshCentral Fans, ## does anyone know how to get the device ID when I am on a agent (Windows + Unix)? The node ID of the group/mesh I can get with "$filepathtomyagent -nodeid" but I need the deviceid. Background is that I want to automate some actions and notifications via meshctrl and to directly communicate with the device from the agent or another host I need to get the deviceid. I am happy for any hint on this topic. Have a great day.
deekerman 2026-02-20 09:24:50 -05:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@si458 commented on GitHub (Jun 19, 2023):

i think you only need the nodeid to communicate to a computer over meshctrl?
what do you mean by deviceid exactually?

@si458 commented on GitHub (Jun 19, 2023): i think you only need the nodeid to communicate to a computer over meshctrl? what do you mean by deviceid exactually?
Author
Owner

@prononext commented on GitHub (Jun 19, 2023):

That is what I also thought but the nodeid is different from the deviceid which I use in the meshctrl command.

So I get the nodeid via my command above and then I compared it to the one which is in the URL of my meshcentral server inside that specific device.

I tried both ids with meshctrl, but only the one I got from meshcentral GUI worked with meshctrl and not the one I got with "meshagent -nodeid" on the agent itself.

Any ideas?

@prononext commented on GitHub (Jun 19, 2023): That is what I also thought but the nodeid is different from the deviceid which I use in the meshctrl command. So I get the nodeid via my command above and then I compared it to the one which is in the URL of my meshcentral server inside that specific device. I tried both ids with meshctrl, but only the one I got from meshcentral GUI worked with meshctrl and not the one I got with "meshagent -nodeid" on the agent itself. Any ideas?
Author
Owner

@si458 commented on GitHub (Jun 19, 2023):

no a clue im sorry, i dont use the meshctrl.js, but ill look into it in my free time for you 👍

@si458 commented on GitHub (Jun 19, 2023): no a clue im sorry, i dont use the meshctrl.js, but ill look into it in my free time for you 👍
Author
Owner

@si458 commented on GitHub (Nov 5, 2023):

if you want to get the nodeid of the device and its windows, you can check the windows registry as its stored there
HKEY_LOCAL_MACHINE\SOFTWARE\Open Source\APPLICATIONNAMEHERE\NodeId

EDIT:
the return value is in hex format, so it needs to be converted

the following can be used to reverse the value in nodejs

function reverseRegistryOperation(hexString) {
    // Replace characters to match the original format
    const buffer = Buffer.from(hexString, 'hex');
    // Encode the buffer to Base64
    const base64String = buffer.toString('base64');
    // Replace characters to match the original format
    const originalBase64String = base64String.split('+').join('@').split('/').join('$');
    // For demonstration, return the original Base64 string
    return originalBase64String;
}
const hexString = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // Replace with the actual hexadecimal string
const reversedValue = reverseRegistryOperation(hexString);
console.log(reversedValue);
@si458 commented on GitHub (Nov 5, 2023): if you want to get the nodeid of the device and its windows, you can check the windows registry as its stored there `HKEY_LOCAL_MACHINE\SOFTWARE\Open Source\APPLICATIONNAMEHERE\NodeId` EDIT: the return value is in hex format, so it needs to be converted the following can be used to reverse the value in nodejs ``` function reverseRegistryOperation(hexString) { // Replace characters to match the original format const buffer = Buffer.from(hexString, 'hex'); // Encode the buffer to Base64 const base64String = buffer.toString('base64'); // Replace characters to match the original format const originalBase64String = base64String.split('+').join('@').split('/').join('$'); // For demonstration, return the original Base64 string return originalBase64String; } const hexString = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // Replace with the actual hexadecimal string const reversedValue = reverseRegistryOperation(hexString); console.log(reversedValue); ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/MeshCentral#4369
No description provided.