The instance name must be the same as computer name

Summary

If you’re like me and you clone your Dynamics 365 virtual machines regularly to create other test instances, you might be hit with the error: ‘The instance name must be the same as computer name’ when you’re trying to install SQL Server. There is a very simple fix for this.

Make the changes

Log into SQL Server Management Studio and run the following:

--Get Help Server Name
sp_helpserver
--Get Help Server Name
sp_helpserver
 
--Drop the Server Name
sp_dropserver "old_servername"
--Get Help Server Name
sp_helpserver
 
--Drop the Server Name
sp_dropserver "old_servername"
 
--Add new Server Name (name of the local machine)
sp_addserver "new_servername", local

Once complete, restart the SQL Server service or the virtual machine. This should now resolve the error.