ERROR in creating profile database

Jun 24, 2011 at 3:37 PM


First of all, thanks for this script, it's fantastic that it is being maintained so regularly.

I have had this error pop up since the last couple of releases:


 - Granting us\srv_devmoss_services rights to SWD-CHISP2K10_ProfileDB...Add-SPShellAdmin :

     "Cannot add us\srv_devmoss_services to the SharePoint_Shell_Access role of the database SWD-CHISP2K10_ProfileDB.

A possible cause of this error is that the account name was already added to the database as a login using a differentuser name than the account name."

At C:\SP2010\AutoSPInstaller\SP2010\AutoSPInstaller\AutoSPInstallerFunctions.ps1:1836 char:67+
                Get-SPDatabase | ? {$_.Name -eq $ProfileDB} | Add-SPShellAdmin <<<<  -UserName $PortalAppPoolAcct    +
CategoryInfo          : InvalidData: (Microsoft.Share...AddSPShellAdmin:   SPCmdletAddSPShellAdmin) [Add-SPShellAdmin], ArgumentException    +
FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddSPShe   llAdmin

Could it be that I am using the wrong service account? And is it harmful since it looks like it's trying to grant access to an account that already has it?

Thanks for any help on this issue.



Aug 7, 2011 at 2:59 PM

Still having this issue? I haven't seen it before - sorry. Anyway I don't think it's harmful to try to add it.


Jun 15, 2012 at 1:57 PM
Edited Jun 15, 2012 at 1:58 PM

1. Connect to SharePoint config database using SQL 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

$db = Get-SPDatabase | Where {$_.Name -eq “SPConfigDB”}
 Add-SPShellAdmin “us\srv_devmoss_services” -database $d


$dbs = Get-SPDatabase
 foreach($d in $dbs) {Add-SPShellAdmin “us\srv_devmoss_services” -database $d}