Having multiple server names on Windows server or client is nice feature you may want to have when you are migrating applications, using servers as part of web server farms, etc.
As opposed to the Linux hostname where names can be arbitrarily changed, names for a machine in the Windows world have multiple dependencies and if you look at the computer name dialog box you only see one single text box.
You may think that adding aliases (CNAME) in the DNS would suffice to have your server targeted using any name you wish.
However, since the appearance of Strict Name Checking , it is far from being enough. You must add several registry keys to your server so it knows it must accept to answer under different names.
Adding alternate DNS name to a server
For this to happen, you must:
- add a REG_MULTI_SZ under: HKLM\System\CurrentControlSet\Services\DNSCache\Parameters\AlternateComputerNames
- one FQDN per line
- do not add the current name of the server
- run ipconfig /registerdns for the modifications to take place
The following script will do that for you in an easy way:
1 2 3 4 5 6 7 8 9 10 |
@echo off if "%1"=="" goto :us set p=%* set p0=%p: =\0% reg add HKLM\system\currentcontrolset\services\DNSCache\parameters /v AlternateComputerNames /t REG_MULTI_SZ /d %p0% /f echo Please run ipconfig /registerdns when you want new DNS Names to appear goto :eof :us echo %~n0 name1 name2... nameN echo makes this computer responds to name1, .. nameN as DNS name in addition to its very own name. |
Adding alternate NetBIOS name to a server
- add a REG_MULTI_SZ under: HKLM\System\CurrentControlSet\Services\LanManServer\Parameters\OptionalNames
- one netbios name without backslashes per line
- do not add the current name of the server
- restart the server service for the modifications to take place
These steps can be done using the following script:
1 2 3 4 5 6 7 8 9 10 |
@echo off if "%1"=="" goto :us set p=%* set p0=%p: =\0% reg add HKLM\system\currentcontrolset\services\lanmanserver\parameters /v OptionalNames /t REG_MULTI_SZ /d %p0% /f echo Please restart the Server Service when you want new NetBios Names to appear goto :eof :us echo %~n0 name1 name2... nameN echo makes this computer responds to \\name1, \\nameN as NetBIOS in addition to its very own name. |
Built-in command netdom
Please note that on the latest versions of Windows, you can use netdom
1 |
netdom computername myserver /add myothername.mydomain.local |
The ‘myserver’ is the main short name. Every alternate name should be entered using a FQDN; THe command will create the above mentioned registry keys in both locations, add the DNS record and even the Kerberos Service Principal Name (SPN) if enough rights are given.
Additional remark
If the changes are not working please do following :
- Locate the following key in the registry: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters
- add the following registry value: DisableStrictNameChecking as REG_DWORD, its value should be 1
Pingback: Alternate Names for File Servers – When Rebooting Is Not The Answer
Thank you – the netdom option was a very useful and to the point.
Direct and to the point and IT WORKS. This is a useful post. Only thing I would add is that if you are doing this to add the name of an old server that you are retiring to a new server, that you will need to delete the old server’s account in AD before adding the old server name to the new server name or it will not work like you hope.
Indeed. In a case of (re)use of an existing name within an Active Directory domain, you have to take care of the computer account object.
Pingback: How and why a host can have multiple netbios names? - Boot Panic