How to restore SharePoint 2010 Foundation after PC renaming?

I renamed local PC name and after reboot SharePoint 2010 Foundation does not work anymore.

At this page it is described to use the PowerShell command:

Rename-SPServer [-Identity] <OriginalServerName> -Name <NewServerName>

I launched PowerShell with Administrator permissions but the execution failed with the message

"Rename-SPServer : The farm is unavailable"

Do you known which could be the problem?


Solution 1:

Rename-SPServer needs to be run BEFORE the servername is changed. It seems that it is a good idea to use the stsadm -o renameserver command instead, even though Microsoft recommends using the powershell command.

See the following article: http://aanikin.wordpress.com/2010/09/01/how-to-rename-sharepoint-2010-server/

I just used the stsadm command successfully when renaming a standalone server, but i did run it before renaming the server. I think that this is generally a good idea.

If everything fails, you can probably run the SharePoint 2010 Products Configuration Wizard and then through Central Administration backup and restore your site collections.

Solution 2:

All above did not work for mee, I also checked the registery but you need a lot of changes do make it work so I skipped that solution.

The problem that I have was that you first need to change the server name in SharePoint before you can change the real server name (what is difficult if you just created a virtual machine from an image).

The solution was quite easy, just rename the virtual machine to the old name. Run rename-spserver (should be run before you change the name) and change the name back. I found this solution on http://blog.walisystemsinc.com/2012_08_01_archive.html

Furthermore after the rename, if you are not using a Domain, you also should reset your SharePoint registered accounts because they have an other prefix (other server name).

Solution 3:

As suggested, the PROPER way would be to change the name back temporarily, run the STSADM tools and change the name to the desired one.

The reason the name change prevents the instance from starting is that there are several places in the registry that refer to the location of the Central Admin and Content Databases. Specifically, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure\ConfigDB, allthough there are others. If you search for the old name with a backslash and the word sharepoint(server\sharepoint), you should find them. STSADM can't make changes to the Config DB unless those references are right. Between those two things, you sholud be able to get it running with re-installing.