SharePoint 2010 Error – Item has already been added. Key in dictionary.

Currently migrating my SharePoint Farm from one domain to another domain due to unresolvable DNS issues.

While reconfiguring the User Profile Service, came across the below error:


Error:

Item has already been added. Key in dictionary: ‘local\svc_SP_Farm’.
Key being added: ‘local\svc_SP_Farm’.


Upon further investigation, identified in the Managed Service Accounts a duplicate of my svc_SP_Farm Service Account.

Removing the duplicate account via remove-spmanagedaccount -identify “Local\svc_SP_FARM” failed because the service account is running the FARM. Annoying.

What it looks like is that I updated the Farm Account password via Central Admin GUI, but also had another Central Admin session open on another server, causing the conflict.

Solution:


  1. Open SharePoint 2010 Management Shell from the Start Menu.
  2. Type the following command:
    $spmanagedaccount = get-spmanagedaccount -identity “Local\svc_SP_FARM”

  3. Then run the following command:
    remove-spmamanagedaccount $spmanagedaccount[0]