Thursday, July 24, 2014

SharePoint Managed Accounts error: Managed Account could not be deleted because other objects depend on it.

After deleting all the service applications and managed account from SharePoint server by using following PowerShell commands,

Get-SPManagedAccount | Where-Object {$_.UserName -eq "Domain\Username"} | Remove-SPManagedAccount

By running the command I got an error saying that,

Remove-SPManagedAccount : An object in the SharePoint administrative framework, “SPManagedAccount Name=managed-account-S-1-5-21-2912393494-653453454-43454533245-4324″, could not be deleted because other objects depend on it. 

We can see this error because the service error we are going to delete is having dependencies. In my case iam using same account for User Profile Service.

By using following commands, we can release the dependencies on the service account.

Get-SPServiceApplicationPool | Where-Object {$_.Name -eq "User Profile Service"} | Remove-SPServiceApplicationPool

After running the command we have to delete the account by running the following command,

Get-SPManagedAccount | Where-Object {$_.UserName -eq "Domain\Username"} | Remove-SPManagedAccount

Hope this helps.

Share this