Rename SharePoint 2010 Server
Take this scenario. You need to clone a SharePoint 2010 server to a different virtual environment. After changing Computer name, Full computer name and Computer description under System information (Right-click on Computer >> Properties) you are tempting to use the recommended Rename-SPServer PowerShell script.
But running this script will get you the error message: “Rename-SPServer : The farm is unavailable“.
Rename-SPServer [-Identity] <OriginalServerName> -Name <NewServerName>
Also, if your SQL DB server is on the same box with your SharePoint 2010 then when you’re trying to access Central Administration you get “Cannot access the database“. That is because the DB server still has the old server name.
The best way to approach the problem is to use the good ol’ Stsadm command.
Make sure you are a member of the local Administrator group then open DOS command prompt and browse to the BIN directory that holds the stsadm.exe.
C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN
There are many ways to access stsadm but for this example I will settle for the easy way.
Type the following command, and then hit Enter:
stsadm -o renameserver -oldservername <YourOldServerName> -newservername <YourNewServerName>
Next step you need to change the public URL in Alternate Access Mappings under Central Administration and you’re done!