3

I know this may depend on computer manufacturers, but I think it's interesting to ask here: hopefully someone knowledgeable can shed some light on this issue.

This question is restricted to Windows machine only.

Assuming that the users don't change the computer name, how likely-- or unlikely-- it is for two computers to have exactly the same name? Like two "LAPTOP-G76WER0O" ( I made that up) floating around in the market, one in China, another in US.

On paper, if the default name is generated randomly, then the chances of two laptop name colliding is slim; there are 36 alphanumeric possible permutation for just one character, and there are at least 8 of them usable ( reserving the front few for Laptop-), so the combination is 36^8=2.8211099e+12. I doubt whether one can hit on such a humongous number by chance.

But I don't know how the computer name assignment is being done, maybe some algorithm ensures that name collision does happen?

ChatGPT/Gemini told me that the chances of name collision is slim, based on the above logic. So here am I asking real human.

10
  • Technically; yes. Likely; yes. Answerable question on SU with a meaningful response; unlikely/no. Is it a problem to have the same name; no, unless they're both trying to enroll onto the same domain. Mar 4 at 8:25
  • @spikey_richie, you mean It's likely to have a same default name for two laptops?
    – Graviton
    Mar 4 at 8:26
  • 1
    Consider Lenovo and Dell. What if they both started their numbering system at "LAPTOP-00000001"? We just don't know. This is why the question isn't really answerable. Mar 4 at 8:35
  • 1
    @spikey_richie that can't happen. Manufacturers can specify the left part of the -, not the right part.
    – LPChip
    Mar 4 at 8:37
  • 2
    "I doubt whether one can hit on such a humongous number by chance" – This intuition is wrong. Your 36^8 is less than 2^42. According to this table for 40 bits we need a population of 1.7e6, and for 48 bits we need 2.8e7, for a collision to occur with probability greater than 0.75. For 42 bits the number will be somewhere in between, say about 1e7. Ten million computers. Obviously this is without other constraints that may lower (e.g. a central catalog that prevents reusing) or raise (e.g. imposed pattern) the chance. Mar 4 at 9:00

1 Answer 1

4

When you install windows, depending on the information specified in the install media, a computername is generated.

Microsoft listed these here: https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-computername

I've copied them to below:

ComputerName specifies the computer name used to access the computer from the network.

Note In Windows 10, users can no longer enter a computer name during OOBE as the name is auto-generated. To set a default computer name pre-OOBE, OEMs can configure ComputerName in the Unattend.xml file and specify a name for the computer. After OOBE, end users can change this default computer name after OOBE by changing it in the System Properties page.

Values If ComputerName is not specified, a random computer name is generated.

If ComputerName set to an asterisk (*) or is included but empty (""), Windows creates a random 15-character name using up to 7 characters from FullName and Organization, then a dash, then more random characters.

ComputerName is a string with a maximum length of 15 bytes of content:

ComputerName can use ASCII characters (1 byte each) and/or multi-byte characters such as Kanji, so long as you do not exceed 15 bytes of content.

ComputerName cannot use spaces or any of the following characters: { | } ~ [ \ ] ^ ' : ; < = > ? @ ! " # $ % ` ( ) + / . , * &, or contain any spaces.

ComputerName cannot use some non-standard characters, such as emoji.

Computer names that cannot be validated through the DnsValidateName function cannot be used, for example, computer names that only contain numbers (0-9). For more information, see the DnsValidateName function.

So yes, 2 computers can have the same computer name, though given there cannot be 2 identical computers in the same network, I'm fairly sure windows install will at least check for that during the installation if the computer has a network connection.

Do note, the chance of you actually having a problem with duplicate pc names is slim, especially if they are not in the same network, given that you can only use hostnames (computernames) in a local area network. And if you purposely try to set the name of your computer to one that already exists in your local area network, windows will fail to register your computer in the network, and as such, there is not going to be a network connection and an error pops up about duplicate computer names which will resolve itself after you rename the computer.

5
  • "windows will fail to register your computer in the network, and as such, there is not going to be a network connection" - really? It shouldn't need a hostname for a working network connection, just an IP address (and a gateway address for internet connection). Sure, you won't be able to address the other computer by its hostname, but everything else should work fine.
    – Bergi
    Mar 4 at 17:48
  • @Bergi What I experienced with a duplicate hostname, is that the DHCP server usually has that hostname also registered and it will not give out an IP address either. Sure, you can manually set an ip address, and then it will work.
    – LPChip
    Mar 4 at 18:28
  • Ah, right. It depends on the DHCP server though, some manage the devices by MAC addresses not by client hostname. In theory the DHCP server could even assign a different hostname than the requested one, but I don't think that's very practical (and in particular, Windows does appear to not support that anyway).
    – Bergi
    Mar 4 at 18:39
  • With duplicate hostnames in the same local network, your mDNS service will not be happy either.
    – iBug
    Mar 4 at 20:47
  • Tested and works fine here, did get a warning about a hostname collision from windows though.
    – Raf
    Mar 6 at 12:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .