Sunday, June 30, 2013

Resolution: Error during encryption or decryption. System error code 997 in SharePoint

I was recently ran into an issue in SharePoint where my Central Administration web app disappeared. When I tried to redeploy Central Administration, I was confronted with the error below.

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

Everything I saw online said the only option was to create a new config database. Personally, I thought that seemed a bit extreme. Well, I found a better option that worked for me, and will probably work for you too.

The problem is caused by the registry key HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\FarmAdmin getting deleted or corrupted. Fortunately, it is a rather easy fix if you know what to do.

  1. Open an elevated command prompt and change directories to %commonprogramfiles%\Microsoft Shared\Web server extensions\12\Bin
  2. Modify the username and password in this command, and run it on each server in the farm (This updates that registry key that got deleted/corrupted).
    stsadm -o updatefarmcredentials -userlogin DomainName\UserName -password NewPassword -local
  3. Modify the username and password in this command, and run it one of your SharePoint servers (this step may fail, but just continue on. The is to update the credentials inside the config database).
    stsadm -o updatefarmcredentials -userlogin DomainName\UserName -password NewPassword
  4. Run this command on each of the SharePoint servers in your farm.
    iisreset /noforce
  5. If you were like me, and you need to reinstall Central Administration, run this command on the server where you want to have Central Administration installed (You may want to choose a different port or authentication provider, I just listed the most common options.).
    psconfig.exe -cmd adminvs -provision -port 8080 -windowsauthprovider onlyusentlm