Many times there are situations when you have to rename a MOSS installation either in your virtual PC environment and also sometimes in production, although the production one is little uncommon but the point is a sharepoint developer at one point or other want’s to rename his sharepoint server. Renaming the server simply will screw up all the settings inside the sharepoint as many places there are hardcoded references to the previous server which has to be remapped in order to run the MOSS server with the new server name. Here in this article i will explain you the step by step process for renaming the MOSS server.There are few resources available on the net which helps you in achieving the same but it was hard for me to find a good resource, so i thought to pen it down so that it can help everyone using Sharepoint. Steps:-

  1. Change Alternate Access Mappings
  2. Run stsadm for renaming the server.
  3. Rename the server physically on windows explorer.
  4. Reboot the server
  5. Update login credentials
  6. Restart IIS
  7. Change identity references in IIS
  8. Reconfigure search index

1.Change Alternate Access Mappings This is the first and foremost step to rename the Sharepoint server.Alternate access mappings can be found at Central Administration>Operations>Alternate Access Mappings Click on the web application url and edit the url to have the new server name.This you have to do manually for every website.   2.Run stsadm for renaming the server. You have to rename the server using stsadm before actually or physically renaming the sharepoint server. The command to rename the server is “stsadm –o renameserver –newservername “[yournewservername]”   -oldservername “[youroldservername]“ ” and this is also shown in the figure below:- stsadm can be found in “C:ProgramFilesCommon FilesMicrosoft Sharedweb server extensions12bin Developers can set the path to be globally accessible for ease of using stsadm instead of navigating to the whole path.How to configure environment variables in order to get the stsadm available globally can be found here :- https://www.smallworkarounds.com/index.php/2009/07/19/sharepoint-quick-tip-add-stsadmexe-to/ 3.Rename the server physically in the windows explorer For this step just right click on the My Computer icon in the start menu and click on properties then on the Computer Name tab just click Change button and rename it to whatever new name you want to give to your sharepoint server installation. 4.Reboot the server After following all the 3 steps mentioned above just reboot your sharepoint server. 5.Update Login Credentials Updating credentials is must as sharepoint server is still mapped to the old username inside the domain and will thus cause problems.To update credentials we will again use stsadm.exe “stsadm –o updatefarmcredentials –userlogin “newservernameusername” –password “yourpassword”   6.Restart IIS IIS needs to be restarted in order to reflect the changes which we have just made in the above steps. Remember to restart the IIS using iisreset/noforce from the command prompt. 7.Changing Identity references in IIS After doing all these changes still sharepoint website’s application pools are mapped to the old username and servername which were used to install the Sharepoint inside the farm.So in order to get rid of this old server name we have to manually change the Identity references in the IIS. Remember if the identity says “Predefined” and the value is set to Network Service then there is no need to play and touch those settings, let them be like that only.     But if the Identity is configurable then you have to replace the old servername with the new servername in the username section and if you want to change the password then you have to type the password and retype it to confirm and press ok After this step almost everything is done you just have to configure search index to function properly. 8.Reconfigure Search Index After renaming the sharepoint server the search index have to be reconfigured the best possible solution is to drop the search index and rebuild it.
After doing all these changes you may still find at some places where few links are referencing your old server name and clicking those links does nothing more then giving a blank page to user saying nothing exists on the server like that which he is asking for. In such scenarios you have to use your hit and trial method and have to find the root element which is causing this trouble and definitely that would be configurable just you have to figure out which is the right spot to configure this. After doing this you might face problems with MySite which can be fixed once editing the People & Groups section of the MySite administration. At last you can navigate through various pages to check that whether your MOSS 2007 server is working or not. Disclaimer :- This article is based on my testing under my virtual environment things may vary and i advice not to test and play with your production farm sharepoint installations as this might damage your sharepoint server. Happy Programming !!!!!!!!!!!!!!!!!!