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:
- Connect to SharePoint config database using Management Studio
- Open SharePoint config database
- Change database dbo using the following command:
- 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.