I installed and configured SharePoint/MOSS 2007 on a Windows Server 2003 machine and also created couple of sites. One day I just thought to modify my computer's name. I did that by right mouse click on "My Computer" -> Properties -> Computer Name -> Change.

Once I changed the computer name, it asked me to restart the system. After restarting the system, all SharePoint sites stopped working. When I tried to open the Central Administration application, it also not worked and shown the error message "Cannot connect to configuration database".

I tried searching this issue in Google and found some people saying that to disconnect SharePoint from the current server farm and reconnect it again. I did the same and successfully disconnected the SharePoint from current server farm.

But when I tried to reconnect it to the server farm it failed in the step 5 with the below error message:

Failed to connect to the configuration database.

An exception of type System.ArgumentException was thrown.  Additional exception information: Error during encryption or decryption. System error code 997.

Again Google was the lone help for me and finally it taken me to a Microsoft support page (http://support.microsoft.com/kb/927156) with below information:

Cause of this issue:

This issue occurs if the Network Service account is used as the farm account. In this situation, when you remove Windows SharePoint Services 3.0 from a stand-alone farm, or when you remove SharePoint Server 2007 from a Windows SharePoint Services 3.0 farm environment, the following registry subkey that is used to encrypt passwords that are contained in the Windows SharePoint Services 3.0 configuration database (configdb) is deleted:

HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ FarmAdmin\

Therefore, when you try to join a Web application that exists in the configuration database that does not use the Network Service account, the Web application account credentials cannot be decrypted. This occurs because the required registry subkey is deleted.

Fix for the issue:

To work around this issue, run Psconfig.exe at the command line to create a new Windows SharePoint Services 3.0 configuration database. To do this, follow these steps:

  1. Click Start, click Run, type cmd in the Open box, and then click OK.
  2. At the command line, change to the following directory:
    \Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
  3. At the command prompt, type the following command to create a new configuration database:
    psconfig -cmd configdb -create -server ServerName -database ConfigDBName -user Domain\User -password Password
  4. Rerun the SharePoint Products and Technologies Wizard.

When I ran the above specified "psconfig" command, first it thrown an error that the user name and password is not required for standalone server farm. Then I removed the user and password part from the above command and ran it again. I executed successfully with the output as shown in the below screenshots:

Then I opened the SharePoint Configuration Wizard and tried to configure the SharePoint again, and this time it configured successfully...hurray...