Even if you’ve planned your SharePoint project properly, or it might be years later, you need to rename your SharePoint 2010 server. This quick tip covers this on SharePoint 2010 which is a much cleaner experience than it was in 2007.  There is an STSADM switch that can handle it, but for 2010, there is a certain procedure to yield best results.  I was able to do this on a single SharePoint server earlier and it worked great!  This was a single SharePoint server with SQL on another server. 

For 2010, there’s a new PowerShell cmdlet for this very thing, Rename-SPServer.  This is this article on TechNet covering the procedure.  It has you renaming the server itself first, then fixing up SharePoint.  However I’ve heard of issues with that, and I had better results by doing it in reverse.  That is, running the PowerShell to fix up SharePoint then renaming the server.  Here is what I did:

  1. Tell SharePoint about the new server name via PowerShell.  This is done via the Rename-Server cmdlet.  Of course get-help is your friend to get details and examples, however the context help of the cmd (and the technet article for that matter) IS WRONG!  It’s funny, because the example is right, but the explanation isn’t.  Go figure, nobody’s perfect.  Anyway, you give the command the old and new server names.  TechNet says the old server name is in the form of a URL.  That throws an error.  It should just be <servername>.  So the whole command would be like:
       1: Rename-SPServer –identity “old_server_name” –name “new_server_name”
     
  2. It should complete, and return a message stating “WARNING: You may also need to update any alternate access mappings referring to <NEW_SERVER_NAME>.  Now just rename your server through the system properties and reboot. 
  3. Once the server comes up, Central Admin still came up for me, and on the old URL.  But after an IISReset, that stopped working (as expected).  I was able to access Central Admin via the new server name.  Go ahead and check the Alternate Access Mappings for the Central Admin web application to ensure it is pointing to the new name.  Correct as necessary.  You could also use the cmdlet New-SPAlternateUrl to add an entry for the Central Admin URL.

That’s it!   Of course if you like, you could write a quick little PowerShell script that would do all this for you.  If you need to do STSADM, you would run the following (assuming its in your system path):

   1: stsadm -o renameserver -oldservername <oldServerName> -newservername <newServerName>