if you have ever wanted to decommission an old file/sql server while bringing another online to replace it and keep the existing hostname alive as an alias of the new system, you may want to force a duplicate spn.
setspn.exe has had duplicate spn detection built-in to it since the windows server 2008 release when using the “-s” option. you can bypass the duplicate spn detection by using the “-a” option however. creation of a duplicate spn is blocked when targeting a windows server 2012 r2 dc using setspn with the -a option. the error message displayed is the same as the one displayed when using the -s option: “duplicate spn found, aborting operation!”
sometimes the file server (nas / ras or a computer where we have a shared folder) is registered in dns as an alias instead of the real hostname. when \\myalias\sharename\file.csv is accessed, we may get the error message “filename, could not be opened”.
to register the spn for the dns alias (cname) records, use the setspn tool with the following syntax:
setspn -a host/your_alias_name computername setspn -a host/your_alias_name.company.com computername
the trick is the -a switch (which doesn’t show up anymore with setspn /help on windows server 2012). if you did -s it will find a duplicate as in this example:
setspn -s host/oldserver newserver checking domain dc=domain,dc=int cn=oldserver,ou=servers,ou=folder,dc=domain,dc=int wsman/oldserver wsman/oldserver.domain.int host/oldserver host/oldserver.domain.int duplicate spn found, aborting operation!
you must register the kerberos service principal names (spns), the host name, and the fully-qualified domain name (fqdn) for all new dns alias records. if you do not do this, a kerberos ticket request for the dns alias record will fail and return the error code kdc_err_s_sprincipal_unknown.