Windows 10

What’s in a (Windows computer) name?

The year was 1983.  A new set of APIs called NetBIOS was introduced, used by the IBM PC Network LAN software.  That API established a device naming convention that allowed for 15 character computer names, plus a one-character suffix to differentiate between types of devices.  That API was then later adopted for token ring, IPX/SPX, TCP/IP, etc., and eventually became a key part of Windows.  And even though every other operating system has supported longer computer names for a long time, Windows devices are still typically using these same 15-character names, 30+ years later.

But it doesn’t have to be that way.  Per Internet RFC 1034, which defines how DNS names should work, you can have a host name of up to 63 octets, with a total length of all parts of the name (including the dots) being 255 octets.  (Why octets and not characters?  With support for Unicode in names, where two octets are required for one character, the two aren’t equivalent.)  So what does Windows support?  Per the Windows Server documentation, it can support 63-octet host names and 255-octet fully-qualified names (FQDN) – except on Active Directory domain controllers, where there are some other considerations, i.e. SYSVOL paths and MAX_PATH limits, that restrict the length to 155 octets).  And that support has been around for a long time.

So it is time to move to longer names?  Maybe.  Let’s explore a little more.  First, how easy is it to assign a longer name?  In the Windows 10 Settings app, pretty easy:  Type in the name you want, up to 63 octets, and you’re good to go:


(Ignore the fact that the text box isn’t big enough to hold 63 characters.)  If you look a little closer though, you’ll see that there are still some of those pesky 15-character names showing up:


So Windows is still generating a 15-character name (makes sense for compatibility I suppose), but commonly-used environment variables like COMPUTERNAME show that name – in fact, there is no environment variable that shows the longer name.  But if you run the PowerShell Get-ComputerInfo command, you’ll see that it knows:


From the prefix on that line, you can guess that it is coming from WMI, using Win32_ComputerSystem, and if we check we first see this:


You have to expand all the properties to see the long name, mixed in with all the short names:


If you try to ping by name, you can see that the long name works and the short name doesn’t:


Alright, if you’re a scripter and you use the %COMPUTERNAME% environment variable you’re probably starting to get a little concerned if you’ve ever needed to refer to the name of the current PC.  But it’s solvable – just script carefully.

But what about ways of setting the computer name?  Let’s start with the unattend.xml.  An example:

<settings pass=”specialize”>
   <component name=”Microsoft-Windows-Shell-Setup” processorArchitecture=”amd64″ publicKeyToken=”31bf3856ad364e35″ language=”neutral” versionScope=”nonSxS” xmlns:wcm=”xxx”>

According to the documentation, no, that only supports up to 15 octets.  So no luck there.  But what about changing it after the fact?  At least the PowerShell Rename-Computer cmdlet supports 63-octet names:


How about using MDM?  The Accounts CSP supports renaming devices with 15-octet names:


But the note mentions that the DevDetail CSP in Windows 10 2004 should be used instead:


Of course that documentation is a little contradictory, since it says Windows 10 1803 and above.  I believe that’s because a cumulative update (Windows 10 2004 functionality backported) added this to earlier releases.

What about Windows Autopilot?  Since it uses the Accounts CSP behind the scenes, it too only supports 15-octet names at this point.

One other point worth discussing while we’re on the subject of computer names:  Do they have to be unique?  In NetBIOS-based derivatives, yes – for those of you who worked with these systems, you’ve probably seen errors (first on-screen and later just logged as events) saying that a duplicate computer name was detected on the network.  And in Active Directory, all computer names need to be unique in the domain.  But in Azure Active Directory, the computer name doesn’t matter – you can have multiple computers with the same name.

So is there a conclusion with all of this?  I would say there are two:

  • Windows does support longer computer names, and has for a long time.  But you still can’t avoid the NetBIOS underpinnings from showing themselves.
  • If you use longer computer names, be prepared to take some extra steps (e.g. not naming devices via unattend.xml) and expect some minor issues (e.g. scripts or apps that use the “shortened” 15-character name).

Or the shortened version:  Try it out at your own risk.

Categories: Windows 10