I am sure that many of you use VPC images or similar for your development environments, and often the requirement will arise to create a new image based on an existing image – for a new developer or a new project or for a variety of other reasons. When developing with SharePoint 2007 (MOSS) and having this on your development environment, this can cause some serious headaches – mainly because you have to give the new image a new name (unless it is not on the same network) and as soon as you rename a SharePoint server it throws a hissy fit (as does SQL Server if this is also on your development environment).
Anyway, I thought I’d share the steps that I go through when duplicated a SharePoint image (and these are pretty much the same steps as renaming an image should this be what you needed to do.
- Go to the Sharepoint Central Administration > Operations > Services on Server and stop "Windows SharePoint Services Search"
- Rename your server, however wait until step 5 until you restart it
- If you have MS SQL Server installed, you will also need to rename this. Go to "SQL Server Management Studio" and execute the following script
EXEC sp_dropserver ‘<old_name>’
GO
EXEC sp_addserver ‘<new_name>’, ‘local’ - Update SharePoint references of the new name by calling the script:
stsadm -o renameserver -oldservername <old server name> -newservername <new server name> - Restart your PC
- If you try to open Central Administration after restarting PC it will try to open the site with the old server name. To recreate your Central Administration site for the new server name, call the following command using a port number for the new location of central admin:
psconfig -cmd adminvs -provision -port 12345 -windowsauthprovider onlyusentlm - Restart IIS and try to open your Central Admin site. It should successfully open your site with new server name
- Go to the "Application Management" and remove websites that reference the old machine name
- If you already have a search index drop this, and rebuild it
Now you should have a nicely renamed machine. You may find you need to create your site collections for SSP and My Sites, but this shouldn’t be too hard.
UPDATE: Today I tried a different method of doing this which also works. I got the steps from a post on the SharePoint University site: http://www.sharepointblogs.com/mirjam/archive/2007/08/06/renaming-a-moss-server.aspx
Here are the steps:
- Open Central Administration, "Operations" Tab, "Alternate access mappings" link
- Modify each mapping item to reflect your newly chosen server name
- Open a command prompt window
- cd "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
- stsadm -o renameserver -newservername <newname> -oldservername <oldname>
- Start Menu | Control Panel | System, "Computer Name" tab, "Change" button.
- Input your new server name
- cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
- stsadm -o updatefarmcredentials -userlogin <domainuser> -password <password>
- iisreset /noforce