Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I understand that changing the host name/computer name for a Windows based machine (Client or Server) requires a reboot. I realize that once a computer name is changed, a pending machine name is stored in the system registry and is applied on next boot. I was not able to find much technical documentation on exactly WHY this was required.

Can someone please point me in the right direction on the technical challenges behind why a host name change is not complete without a system reboot ?

share|improve this question
1  
Added a comment to the accepted answer with a link to an MSDN article on why a reboot is required. –  Ameer Deen Aug 19 '13 at 5:15
add comment

1 Answer 1

up vote 47 down vote accepted

You don't have to restart immediately after renaming the machine... just don't expect every service and function to pick up on the new name.

Things such as system environment variables are read once, at system startup. If you change those variables, the various components of Windows won't pick up on them until they're restarted. Some of those components are so deeply integrated with the OS, you might as well restart the entire OS.

Many Windows services and applications, both those written by Microsoft as well as 3rd party, that use the system's hostname, typically only read it once at startup and never read it again.

I know if I was writing an application that read the machine's hostname, it would be pretty silly of me to periodically poll for it just in case it changed.

In an operating system such as Linux, you see the same thing. You can change the hostname without rebooting, but you do have to restart some very basic components of the system in order to get them to pick up on the new name. Linux is more modular than Windows, although Windows has come a long way in terms of modularity.

share|improve this answer
9  
Thanks for the tip Ryan. I looked up the code for System.Environment.MachineName (using dotnetpeek). It uses the GetComputerName function in Kernel32.dll which: "Retrieves the NetBIOS name of the local computer. This name is established at system startup, when the system reads it from the registry." (msdn.microsoft.com/en-us/library/windows/desktop/…). In other words, you're right its simply cached on startup. Just wanted some documentation to back it up. Thanks. –  Ameer Deen Aug 18 '13 at 17:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.