This applies to Windows Server 2012, but also previous versions of Windows. It’s caused by using a product key that is mismatched with the installed product. For example, you may have installed a version of Windows Server 2012 that requires a MAK key, but the product key you are entering is a KMS key. The fix for the DNS name does not exist error is to either run the following command in a command prompt that has been Run as Administrator:

slmgr.vbs /ipk <<Product Key>>

Alternatively you can simply enter the correct Windows Server 2012 product key from the Product ID Windows Activation wizard launched from the Server Manager (because the one launched from the properties of the computer won’t prompt for a new product key).