# MachineName of Windows hosts

**URL:** https://forum.duplicati.com/t/machinename-of-windows-hosts/20000
**Category:** Developer
**Created:** [January 23, 2025, 9:58am UTC](https://forum.duplicati.com/t/machinename-of-windows-hosts/20000 "2025-01-23T09:58:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![macSOSfr](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/m/7bcc69/32.png) [@macSOSfr](https://forum.duplicati.com/u/macSOSfr)
#### Post date: [January 23, 2025, 9:58am UTC](https://forum.duplicati.com/t/machinename-of-windows-hosts/20000/1 "2025-01-23T09:58:35Z")

</div>

Hi!

_Context: Windows 11 Pro, Duplicati - 2.1.0.2\_beta\_2024-11-29_

The MachineName created upon installation of a new host seems to be taken from the Windows Registry (Computer\HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName), which doesn’t reflect the full computer name. This name is truncated to 15 characters and raised to uppercase.  
This MachineName is then used during the registration process into the Console WebApp.  
Apart from cosmetic considerations there are obvious operational/support reasons to see the full computer name in the list of the registered machines in the Console WebApp. So, would it be possible to have the registration process to use the full computer name, taken for instance from within this Registry key: Computer\HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

 ![Capture d’écran 2025-01-23 à 10.27.06](https://forum.duplicati.com/uploads/default/original/2X/4/40f7d296840a47fd02082f88207d63601517a232.jpeg)

 ![Capture d’écran 2025-01-23 à 11.34.20](https://forum.duplicati.com/uploads/default/original/2X/e/e47c6c43d0bab1e4768090b0abbc9a99ec5c843e.png)

 ![Capture d’écran 2025-01-23 à 10.31.58](https://forum.duplicati.com/uploads/default/original/2X/d/d2ac591ea5e4c60e58d0547ef2c38404f6c0201d.png)

---

<div class="post-metadata">

### Author: ![marceloduplicati](https://forum.duplicati.com/user_avatar/forum.duplicati.com/marceloduplicati/32/11557_2.png) [@marceloduplicati](https://forum.duplicati.com/u/marceloduplicati)
#### Post date: [January 23, 2025, 10:33pm UTC](https://forum.duplicati.com/t/machinename-of-windows-hosts/20000/2 "2025-01-23T22:33:43Z")

</div>

This is because we use **System.Environment.MachineName** which on Windows returns the NetBIOS name of the machine, which is limited to 15 chars.

Here is the actual [interop](https://github.com/dotnet/runtime/blob/f196875c5d0441364f6538d2dd8fc4e3eb1ff108/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs#L130) and underlying [call](https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/WinSock/Interop.gethostname.cs#L12) and [finaly](https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-gethostname)

Out of curiosity, I wonder if you can try to ping “Fred-VM-Win11Pro” from another machine in the network, or just “FRED-VM-WIN11PR” is reachable.

@kenkendk

---

<div class="post-metadata">

### Author: ![macSOSfr](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/m/7bcc69/32.png) [@macSOSfr](https://forum.duplicati.com/u/macSOSfr)
#### Post date: [January 24, 2025, 8:17am UTC](https://forum.duplicati.com/t/machinename-of-windows-hosts/20000/3 "2025-01-24T08:17:38Z")

</div>

@marceloduplicati  
Thank you.  
I am running multiple VMs (2 on macOS, 1 on Win11), each of them alone on their own network. NetBIOS is not routable so I cannot do what you asked.

Similarly, the issue is the same with macOS. You seem to use the NetBIOS name which can lead to odd names. I have uneven results on the way the NetBIOS name is defined by macOS. You seem to take the output of the hostname -s command which in effect is the NetBIOS name (truncated to 15 chars).  
On macOS, the full computer name is got from scutil --get ComputerName and you could use scutil --get LocalHostName to build up the machine-name during the registration process in the Console webapp. See screenshots below.

More importantly though: the registration into the Console webapp is relying on the machineid. I did a test:

- I registered machineA with abcd1234 as machine-id
- I decided to rename machineA to machineB from an OS perspective.
- Obviously nothing changed in the console.
- I unregistered the machine, ie proper unregister from the Host and delete the registered machine in the Console
- I re-registered the machine
- And guess what? The machine reappearing on the Console is still named MachineA with the same machineid

So the unregister process in the Console doesn’t clean up things as it should.

 ![Capture d’écran 2025-01-23 à 12.18.40](https://forum.duplicati.com/uploads/default/original/2X/0/02b2abb4348cb096b338e5a4df2e911919e2aa28.png)

 ![Capture d’écran 2025-01-23 à 12.18.58](https://forum.duplicati.com/uploads/default/original/2X/b/b1199582069dc4a68d96a6fe5b7878cb1e4a60b9.jpeg)

 ![Capture d’écran 2025-01-23 à 12.19.34](https://forum.duplicati.com/uploads/default/original/2X/3/3279f62387366c31cb0e03e8b5d19e9b73f4a9db.png)

 ![Capture d’écran 2025-01-23 à 12.22.19](https://forum.duplicati.com/uploads/default/original/2X/1/17404f5f460335c1cc126ea6e7a11be20abcd907.png)

 ![Capture d’écran 2025-01-23 à 12.15.50](https://forum.duplicati.com/uploads/default/original/2X/3/39f5e0524e622c202f5f36532d25c105f177258a.png)

---

<div class="post-metadata">

### Author: ![marceloduplicati](https://forum.duplicati.com/user_avatar/forum.duplicati.com/marceloduplicati/32/11557_2.png) [@marceloduplicati](https://forum.duplicati.com/u/marceloduplicati)
#### Post date: [January 24, 2025, 1:05pm UTC](https://forum.duplicati.com/t/machinename-of-windows-hosts/20000/4 "2025-01-24T13:05:06Z")

</div>

Indeed uneven results on MacOS.

On one of my macs, Sonoma 14.3 M3, I’ve renamed to test

Environment.MachineName = “Marcelos-MacBook-Pro” which is 19 bytes long, so not a NetBios capped name  
scutil --get ComputerName = “Marcelo’s MacBook Pro”  
scutil --get LocalHostName = “Marcelos-MacBook-Pro”

> So the unregister process in the Console doesn’t clean up things as it should.

I found two caching issues around that, one on the backend and one on frontend. I will definitely have a further look on these issues. Thanks.

---

<div class="post-metadata">

### Author: ![kenkendk](https://forum.duplicati.com/user_avatar/forum.duplicati.com/kenkendk/32/5305_2.png) [@kenkendk](https://forum.duplicati.com/u/kenkendk)
#### Post date: [January 24, 2025, 2:57pm UTC](https://forum.duplicati.com/t/machinename-of-windows-hosts/20000/5 "2025-01-24T14:57:19Z")

</div>

> [@macSOSfr](#):
>
> This MachineName is then used during the registration process into the Console WebApp.  
> Apart from cosmetic considerations there are obvious operational/support reasons to see the full computer name in the list of the registered machines in the Console WebApp. So, would it be possible to have the registration process to use the full computer name, taken for instance from within this Registry key: Computer\HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Yes, that is a good idea. I have [registered an issue for this](https://github.com/duplicati/duplicati/issues/5907).
