Windows – Can fully-qualified hostname be used as a unique identifier

hostnamewindows

If I get the fully qualified computer name on a Windows server (2K3 or 2K8) using the GetComputerNameEx() API call, can I rely on that name to be unique on that particular domain? That is, can I assume that only a single active physical or virtual machine will have that fully qualified name at a given time?

As a second question: is it guaranteed that all Windows machines will have such a fully-qualified name?

Best Answer

A properly functioning Windows Active Directory domain will not allow two computers with the same FQDN to exist within it.

All Windows computer joined to a domain will have a FQDN that includes the Active Directory domain(s) that make up its location in the forest. It might be possible to change the FQDN of a domain member by changing the primary DNS suffix using netdom computername /Add: and netdom computername /MakePrimary: It may also be possible to change HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Paramaters\Domain manually. This will require further testing to see if it's possible to alter a PC's FQDN away from a domain's heirarchy while it is still a member.