Cannot connect to servername on a new sql instance

I’m not an expert at SQL by any means but I installed a new version of SQL server 2005 and got a cryptic message “Cannot connect to servename. Additional information – An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error:40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
I thought it was ironic that I couldn’t use the management software to manage the system to try and work out what was wrong. After enabling TCP/IP on the server interfaces I was still not able to connect. Google searches didn’t return any useful information. After a while of testing various things we discovered that changing the Servername entry to be servername\instancename it works. As this is a replacement server the instance for SQL is not the same as the hostname for the server. In my case I had to put the servername as server2\server (with server being the instance created and the same as the instance on the current live server).
Hopefully this will save somebody some time.