Manage Learn to apply best practices and optimize your operations.

Win10 ComputerName Generation

I just got back from a Spring Break mini-vacation yesterday, and am back at work today. When I tried to log in to my Surface Pro 3 remotely just now, I realized a couple of things. One: I couldn’t find the device under its usual moniker. Two: I did eventually identify it as DESKTOP-1D8K0YZ. This is a randomly generated computer name. It appears during routine Win10 installation, when a name isn’t specified in Unattend.xml using Sysprep. “Aha!” I thought to myself, “I forgot to rename the machine when I did that last clean install.” This led to the question “How does Win10 ComputerName generation work, anyway?”

In trying to make a “trivial” (case-only) ComputerName change, I learn that such changes are not significant to the rename-computer function in Windows 10. Interesting!
[Click image for full-sized view.]

How Win10 ComputerName Generation Works

As is so often the case with such questions, a Microsoft Hardware Dev Center article provides a good answer. The “ComputerName” article provides good information and guidance on this topic. It starts with this helpful note:

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.

Here are some useful facts about what happens during installation, and about what may (and may not) appear in a valid Windows 10 ComputerName string:

  • If no ComputerName is pre-specified (using Unattend.xml), a random computer name is generated.
  • If the install occurs when values for Fullname and Organization (more values from Unattend.xml) are lacking, the ComputerName takes the form “DESKTOP-XXXXXXX” where “XXXXXXX” is a randomly generated string. Note that such strings will always be 15 bytes in length.
  • ComputerName strings can include ASCII or multi-byte characters (such as Kanji, Hangul, and so forth) as long at they don’t exceed 15 bytes in total length.
  • A ComputerName string cannot include spaces or any of the following reserved characters:
    { | } ~ [ \ ] ^ ‘ : ; < = > ? @ ! ” # $ % ` ( ) + / . , * &
  • ComputerName must also be able to be validated through the DnsValidateName function (which means purely numeric strings don’t work, either). See this discussion of the DnsValidateName function for more details.
  • You can use the rename function in the System widget in Control Panel to rename your PC, or simply run the “Rename-Computer -NewName “<newname>” command in an administrative PowerShell session. Either way, you must reboot the OS for the new name to “take.”
  • Though the Rename-Computer command preserves case in ComputerName strings, case doesn’t matter when it comes to resolving or differentiating such strings. I learned this by observation in writing this blog post, as shown in the preceding screen capture.

My good friend and business partner, Kari Finn, has created a YouTube video on how to name a PC during setup that explains a crafty end-around for this apparent Windows 10 limitation. Check it out at “How to name PC at Setup.”

Virtual Desktop