Computername registry parameter stores the computername. This registry key can be located under the node HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlComputerNameComputerName.
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlComputerNameActiveComputerName 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 will have the string mypc1. Now suppose I have changed the machine name to mypc2 using computername properties UI. Now the parameter in ComputerName will have mypc2 where as the parameter in ActiveComputername will still have the old name mypc1. After rebooting the machine, both the parameters will have 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_MACHINESYSTEMCurrentControlSetControlComputerNameComputerName /v computername
You can get computer name from TCPIP registry keys also.
Reg query HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v Hostname
Domain name registry key:
Domain name is stored in the following registry key
Domain under HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters
To retrieve domain name from registry using windows command line:
Reg query HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters /v Domain