≡ Menu

Computername registry key

If you want to look up registry key database to fetch computer name/domain name, then this post helps you find the key that has this information.

  1. Open registry editor with the command regedit
  2. Navigate to the node HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
  3. On the right side pane, look for the value ComputerName. This would show you the computer name.

This key shows computer name in all Windows versions – Windows 7, 8 and 10.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName also has a key with the same name Computername which stores the active computer name.


To explain the difference between these two registry keys, suppose the machine name is mypc1. At this point both the registry keys point to mypc1. Suppose I change the computer name to mypc2 from UI. Now the key ComputerName points to mypc2 where as the parameter in ActiveComputername still has the old name mypc1. After rebooting the computer, both the keys point to the new name mypc2.

How to get full computer name from registry key?

Looks like there is no registry key that stores full computer name. Computer name and domain name are stored separately.  You can query both these registry key values and then combine them to get the full computer name. Let’s see how to retrieve these values from registry keys.

To retrieve computer name  from registry

Reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName /v computername

You can get computer name from TCPIP registry keys also.

Reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpipParameters /v Hostname

Domain name registry key:

Domain name is stored in the following registry key

Domain under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpipParameters

Command to retrieve domain name from registry from CLI:

Reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpipParameters /v Domain
{ 3 comments… add one }
  • Walt May 24, 2016, 3:31 pm

    Thanks for confirming my guess as to what the two different keys meant!

  • J September 27, 2018, 3:39 pm

    Why are all the slashes in your registry paths missing?

    • nlgtechblog October 23, 2018, 5:03 am

      Thanks for pointing that out. Fixed the formatting issue.

Leave a Comment