Removing a Managed Account from SharePoint 2010
March 22, 2010 5 Comments
Hello to my two regular readers and people who accidentally clicked this link from twitter! My apologies that it has been so long since my last post.
This morning I found a peculiar little quirk of SharePoint 2010 today when trying to make changes to the Managed Accounts on one of my farms.
This error was coming up whenever I tried to access the "Managed Accounts" section of security under Central Administration. Obviously this caused a problem as I could not add / remove any service accounts, and one of them was corrupted. How did I manage to corrupt a service account? Thats a story for another time.
So I figured the easiest way to get rid of this would be to familiarize myself with the SharePoint PowerShell Cmdlets.
First off I loaded the appropriate PowerShell snapin via "Add-PSSnapin Microsoft.SharePoint.Powershell"
By using the "Get-Command -Noun "SP*" I was able to get a full list of SharePoint commands, and pretty much right where I expected it was "Get-SPManagedAccount"
By using this command I was able to output a list of my Managed Accounts :
Simple PowerShell logic dictated that the appropriate commands were most likely "New-SPManagedAccount", "Set-SPManagedAccount" and "Remove-SPManagedAccount".
Fairly quickly I was able to remove the offending ManagedAccount and restore functionality to the "Managed Accounts" section of Central Administration.
For those not familiar with PowerShell this is all very simple and easy to accomplish. If you are ever in doubt on how to use a PowerShell command just type in "Get-Help CommandName -full" and you will have a whole heap of information to help you out.
I had this problem after removing an account from AD that was listed ‘managed accounts’ but not actually assigned to any services. I added the account back to AD. This allowed me back into the managed accounts page on central admin, but I couldn’t remove the account.
Remove-SPManagedAccount -identity “domain\accountname” failed.
Get-SPManagedAccount -identity “domain\accountname” worked though, so I did:
Get-SPManagedAccount -identity “domain\accountname” |Remove-SPManagedAccount and that did work!
Cheers
@Jonathan Maney: You are my hero for the next 5 minutes! Thanks a lot
RE:Blogger
Wow.Man Good Hint.
I also get usernames truncated with an ellipsis (…) when running Get-SPManagedAccount, as shown in the screenshot. I don’t see from the help for this command how to return a wide format so that I see the full usernames.
Hi Vincent,
Try this :
get-spmanagedaccount | ft username
Regards,
Mark