Restore SharePoint managed accounts

Sometimes you get an error when you’re working with managed accounts or while creating a new SharePoint WebApplication:

The given key was not present in the dictionary

The easiest way to restore this:

Try to delete the managed account. If this does not work, then you’ll have a problematic managed account. First create a new managed account and move the service applicationts to the managed account you just created.

Then remove the problematic managed account. You can change a service account as follow:

$Farm = Get-SPFarm
$Service = $Farm.Services | where {$_.TypeName -eq “Microsoft SharePoint Foundation Web Application”}
$Password = Read-Host -Prompt “Please enter your password” -AsSecureString
$NewAppPool = New-Object Microsoft.SharePoint.Administration.SPApplicationPool($NewAppPoolName,$Service)
$NewAppPool.CurrentIdentityType = “SpecificUser”
$NewAppPool.Username = $NewAppPoolUserName
$NewAppPool.SetPassword($Password)
$NewAppPool.Provision()
$NewAppPool.Update($true)

When completed, change the service applications back.

Leave a Reply

Your email address will not be published. Required fields are marked *