This one was a new one… and a bugger to track down! While renaming domain computers, several of the rename operations would encounter an error during the rename process of
The following error occurred attempting to rename the computer to [New Name]:
The directory service is busy.
Well, if you have SQLExpress or SQLServer installed, the error may be leading you down the wrong path. In our particular case, the error was a security error related to SQLExpress / SQLServer SPNs (Service Principal Name). Basically, the rename operation could not rename the SPNs.
How to identify a potential SPN issues
- Open a CMD prompt as an administrator
- enter the command:
setspn –L [Computer Name]
- Check for *any* registered SPN which is in the format of
MSSQLSvc/[Computer Name]:[Instance Name]
In short, if you have *any* SPN which starts with MSSQLSvc, you will not be able to rename your computer!
How to fix SPN issues
- For *each* identified SPN above, you must delete the SPN using the following command:
setspn –d [SPN Name] [ComputerName]
Important: You must use the full SPN name as identified via the setspn –L command. These will be in the format of MSSQLSvc/Computer.domain.tld:instance
That is it! You can now rename your computer!
Your suggestion did not work for me. Is there something incorrect with my syntax? Thanks.
C:\WINDOWS\system32>setspn -d MSSQLSvc/IHBI-Z220-62682.qut.edu.au:QSRNVIVO10 IHBI-Z220-62682
Unknown parameter MSSQLSvc/IHBI-Z220-62682.qut.edu.au:QSRNVIVO10. Please check your usage.
At first glance, it looks like you may have a space in the SPN name (I.E. the QSRNVIVO10 IHBI-Z220-62682 looks like there is a space between the 0 and the I).
If the name really does contain a space, put the entire name in quotes.
setspn -d “MSSQLSvc/IHBI-Z220-62682.qut.edu.au:QSRNVIVO10 IHBI-Z220-62682”
Thanks! Saved me a lot of time. I would have never figured this out.
great stuff. Had to figure some of the syntax out myself, but great stuff. Thank You.
Live saver thank you!
Any idea *why* this happens and why this solution works? I have the same problem, but am having trouble finding a solution. Also, I’ve seen workstations with the SPN entry but can still be renamed. However, those particular machines had another entry that looked like “MSSQLSvc/[Computer Name]”.
This worked for me. Many thanks!
Thanks for the information as this worked with resolving my issues
Excellent! Worked for me. SQL was the issue.
Thanks buddy ! it worked for me !!
Great tutorial! Finally found something that works concerning this issue. Now I don’t need to go and format the PC that I am working on.
it gaves me this error
FindDomainForAccount: Call to DsGetDcNameWithAccountW failed with return value 0x00000525
Unable to locate account SQLEXPRESS
noted that im using windows server 2016 and AD 2012 r2
great stuff. I found this error on an azure windows vm which didnt had sql installed. But still I got this error while I was simply trying to join the computer to domain.(domain join command Add-computer has NewName parameter also to specify during the domain join porcess.
Saved Tons of time
Thanks for sharing. This was my first search result and fixed the problem for me.
Thanks for excelent advice.