Add-SPShellAdmin–user cannot exist in database

If you try to add user to SharePoint shell administrator role you may get the following error: “Cannot add <user> to the SharePoint_Shell_Access role of the database SharePoint_Config_<Guid>. A possible cause of this error is that the account name was already added to the database as a login using a different user name than the account name.”

If user is database user through dbo role and it has not added to shell admin role then the username does not appear in shell administrators list if you run Get-SPShellAdmin. You cannot add this user to shell administrator role using Add-SPShellAdmin. Also adding user to SharePoint shell access role in database gave no results.

Here’s how I solved it:

  1. Connect to SharePoint config database using Management Studio
  2. Open SharePoint config database
  3. Change database dbo using the following command:
    sp_changedbowner @loginame=some_other_user’
  4. If there were no errors then in SharePoint PowerShell console run Add-SPShellAdmin again

I don’t know why Add-SPShellAdmin is not able to add existing dbo user to shell access role. Going through steps given here I was able to solve the problem.


Leave a Reply

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