Add an Alias/CNAME to Windows Fileserver

Hey there.

This will be a very short one.

Last week I had to replace a physical server at a small engineering office. This was an old Windows SBS 2011, that was only used for the AD and the file services. We migrated the mail service a couple of years ago to the cloud and WSUS started to annoy me, so I disabled it.

For the replacement, we used a Dell PowerEdge T350 Tower Server. We usually do not sell Dell products for multiple reasons. I do like the hardware though and this server is pretty cool. Especially the 2 hot swap M2 NVMe SSDs.

Windows Server 2019 was used for the OS and as already mentioned, this system won’t do much more than act as a domain controller and file server.

Since there is no easy way (i know of), to keep the old hostname after migrating the domain controller, I decided to simply set the old hostname as a CNAME that points to the new server. Here lies the problem though. The file services do not accept connections to anything other than the IP and the original hostname if the system does not know about the new alias and has the required SPN.

If we want to use the old hostname we have to assign it to the system. This will also create an SPN automatically.

Managing Aliases in Windows Server

Open the powershell as administrator, and enter the following to check the current aliases.

PS /home/user> netdom computername <hostname> /enum
All of the names for the computer are:

AD01.domain
The command completed successfully.

Now, if we want to add an alias.

PS /home/user> netdom computername <hostname> /add <alias.domain>
Successfully added bobby2.domain
as an alternate name for the computer.

The command completed successfully.

To remove an alias, just replace “add” with “rem”.

PS /home/user> netdom computername <hostname> /rem <alias.domain>
Successfully removed bobby2.domain
as an alternamte name for the computer.

The command completed successfully.

That’s it. Now we can use the aliases to connect to the file service.

Leave a Reply