Item has already been added. Key in dictionary.. How do I clean up service account? Very nasty
-
Friday, October 01, 2010 12:03 PM
I made a few changes in service accounts and now CA Configure Service Accounts and other application pages fail with wtth:
Item has already been added. Key in dictionary: 'dev\svcebrd' Key being added: 'dev\svcebrd'
Here is what log says when FarmCredentialManagement.aspx opens:
SID |0 cannot be resolved. Using old name: |1. |2
System.ArgumentException: Item has already been added. Key in dictionary: 'dev\svcebrd' Key being added: 'dev\svcebrd' at System.Collections.SortedList.Add(Object key, Object value) at Microsoft.SharePoint.WebControls.ManagedAccountPicker.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at ASP._admin_farmcredentialmanagement_aspx.__BuildControl__control22(Control __ctrl) at Microsoft.SharePoint.WebControls.InputFormControl.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at ASP._admin_farmcredentialmanagement_aspx.__BuildControl__control16(Control __ctrl) at Microsoft.SharePoint.WebControls.InputFormSection.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
stsadm -updatefarmcredential did not help...
I need a way of deleting this account. As a last resort I can probably delete it from Objects table in config database, but wondering if there is a better solution
-Stan
All Replies
-
Friday, October 01, 2010 12:08 PM
"I made a few changes" ?? What exactly did you change.
PS - The "SharePoint/System" account is a dummy account placeholder with a SID value of 0.
regards
Martin Hatch
MCPD .Net Web Development
MCTS WSS 3.0 | MOSS 2007
Visit my Blog - www.martinhatch.com -
Friday, October 01, 2010 12:22 PMI registered a new management account while setting up a new service application. Now dev\svcebrd managed account is listed twice on CA - Managed Accounts and I cannot delete it from on page (Item has already been added. Key in dictionary: 'dev\svcebrd' Key being added: 'dev\svcebrd')
-
Friday, October 01, 2010 12:32 PM
Ahh ok .. nothing weird then (was worried you'd been poking around the API or something).
This isn't really a "using Visual Studio" question.
Have you tried using the PowerShell command Remove-SPManagedAccount ?
regards
Martin Hatch
MCPD .Net Web Development
MCTS WSS 3.0 | MOSS 2007
Visit my Blog - www.martinhatch.com- Marked As Answer by Stan B Friday, October 01, 2010 12:50 PM
-
Friday, October 01, 2010 12:34 PM
I've seen a whole bunch of people with "Item has already been added" issues.
It seems that this normally happens when you change the domain and then re-add the same user account.
Most people seem to suggest the only workaround is re-build the Farm (i.e. re-install SharePoint) and re-attach the content database.
If you could do this in an isolated environment then you should be able to run both farms side-by-side before performing a DNS switchover, then decomission the old Farm.
regards
Martin Hatch
MCPD .Net Web Development
MCTS WSS 3.0 | MOSS 2007
Visit my Blog - www.martinhatch.com -
Friday, October 01, 2010 12:51 PM
Ahh ok .. nothing weird then (was worried you'd been poking around the API or something).
This isn't really a "using Visual Studio" question.
Have you tried using the PowerShell command Remove-SPManagedAccount ?
regards
Martin Hatch
MCPD .Net Web Development
MCTS WSS 3.0 | MOSS 2007
Visit my Blog - www.martinhatch.com
That removed one of them. Thank you very much! -
Friday, October 01, 2010 12:53 PMYou're welcome :)
regards
Martin Hatch
MCPD .Net Web Development
MCTS WSS 3.0 | MOSS 2007
Visit my Blog - www.martinhatch.com -
Wednesday, November 17, 2010 2:02 PM
Hi all,
i'm facing the same problem. I tried to remove the managed account using PS but i'm getting the following error:
Remove-SPManagedAccount : The account mydomain\usrname was not found.
At line:1 char:24
+ Remove-SPManagedAccount <<<<
+ CategoryInfo : InvalidData: (Microsoft.Share...eManagedAccount:
SPCmdletRemoveManagedAccount) [Remove-SPManagedAccount], InvalidOperationE
xception
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRemoveMa
nagedAccountAny ideas/suggestions?
Thx in advanced.
Gabriel
-
Tuesday, December 21, 2010 6:28 PM
I am also having this problem. Tried to remove one of the duplicate accounts and get this:
Remove-SPManagedAccount : The account [domain]\[serviceaccount] is still being used by these components:
Microsoft Project Server Queuing Service.
http://vcollogan.knows.it http://twitter.com/orbhot -
Thursday, January 06, 2011 3:09 PMOnce you get "still being used by ..." reinstalling the whole farm appears to be the only solution. I couldn't figure out how to release managed account used by forefront.
-
Thursday, January 13, 2011 3:47 PMI've the same problem. Is there not another option? I can't remove the account with remove-spmanagedaccount. The account is in use by a services.
-
Wednesday, February 16, 2011 6:13 PM
I've the same problem. Is there not another option? I can't remove the account with remove-spmanagedaccount. The account is in use by a services.
Then you are done - reinstall the farm ): It is amazing how easy it is to break SP 2010, just a couple of wrong clicks out of sequence... -
Monday, August 29, 2011 9:52 PM
The way it happened to me was having 2 different browser tabs of Central Administration open, and having that Configure Managed Accounts or Configure services Accounts screen open and *not* hitting the Cancel button on that page... after that, any time I go to the Configure Managed Accounts screen I get the error "Object reference not set to an instance of an object"
The ULS logs show several errors including the topic title of this thread (thats how i got here)... and:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.ApplicationPages.ManagedAccountsDataSourceView.FillDataTable(DataTable table, DataSourceSelectArguments selectArguments)
at Microsoft.SharePoint.WebControls.DataTableDataSourceView.Select(DataSourceSelectArguments selectArguments)
at Microsoft.SharePoint.WebControls.AdministrationDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Reinstall the entire farm? Give me a break... what a nightmare!
-
Saturday, October 15, 2011 9:02 AM
**********PARTIAL SOLUTION FOR DUPLICATE MANAGED ACCOUNTS ***********
If you were lucky enough that one of your duplicate managed accounts has a unique property (quick check by executing get-spmanagedaccount) then you are in luck.
In this case you absolutely DONT NEED TO REINSTALL THE FARM. If you understand code youd know that the aspx behind sharepoint is just trying to hash the same values to a hash table when it pulls the data from the CONFIG DB.
Jexecute the following PS-script if either of the managed accounts has a unique property
get-spmanagedaccount | where-object {$_.username -eq "[DOMAIN]\[name]" -and $_.AutomaticChange -eq "True" [or some unique property to distinguish it from the other]}| Remove-spmanagedaccount
If you are able to find a GUID or some other unique property for a managed account then you're definitely in the clear. The problem with managed accounts is that they are encrypted so you will not be able to find them in the AllUsers or Objects table in the Sharepoint databases. I couldnt find a guid so i just used the "AutomaticChange" property.
Hope this helps someone.
- Proposed As Answer by Narbar Saturday, October 15, 2011 9:03 AM
-
Wednesday, December 21, 2011 3:45 PM
The question is why CA even allows adding the duplicate managed accounts. We wouldn't have this discussion if it didn't. These duplciate accounts are being added not through some kind scripts, low-level API or database hacks, but through CA interfface. Of course there is a chance for the people to do things in a wrong way or in a wrong sequnce, especially for the relatively new product, but shouldn't Central Admin UI validate the input?? How hard is it to check a new managed account for dups before inserting it?
-
Tuesday, January 31, 2012 1:21 PM
Hi guys,
I had the same issue the other day. I blogged how I fixed it. Hope it may help someone struggling with their accounts :)
http://www.sharepointshowboat.com/2012/01/sharepoint-2010-item-has-already-been.html
- Proposed As Answer by Andy Goodwin - MCTS, MSITPro SharePoint Wednesday, June 20, 2012 7:48 PM
-
Monday, June 18, 2012 3:01 PM
Thank, you for command "
get-spmanagedaccount | where-object ...
"
It's really key for deleting dead SID from SharePoint farm account.
Kind regards, Petr.
- Edited by Petr Samonchev Monday, June 18, 2012 3:14 PM
- Edited by Petr Samonchev Monday, June 18, 2012 3:16 PM
-
Wednesday, June 20, 2012 7:49 PM
Read this before rebuildning your entire farm!!

