1

I'm trying to update a site collection's owner and secondary with PowerShell. Currently, they're blank and CA fails. I enter the following in PowerShell:

Get-SPSite "http://company/division/site" | %{Set-SPSite $_ -OwnerAlias "spadmin" -SecondaryOwnerAlias "altspadmin"}

The following error is returned:

Set-SPSite : At line:11 char:46
+ Get-SPSite "http://company/division/site" | %{Set-SPSite $_ -OwnerAlias "spadmin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletSetSite:SPCmdletSetSite) [Set-SPSite], SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletSetSite

(The highlight is under the Set-SPSite command.) The names are valid. Even the domain\name fails.

Note: I don't know if this has something to do with the error, but I notice that the content db is missing the SPDataAccess and SPReadOnly. Do you know how to get these roles installed?

  • Note: <User> should be added with this format <domain>\<username>. not as you did "spadmin" so it should be "domain\spadmin" – Mohamed El-Qassas MVP Jun 13 '17 at 22:52
  • ??? Yes. I did that. (Per my explanation.) – Landfall Jun 13 '17 at 22:59
  • Sorry, I don't note that! but in error message you have tried this cmdlet without domain !! Get-SPSite "http://company/division/site" | %{Set-SPSite $_ -OwnerAlias "spadmin" so Could you please try this command Set-SPSite -Identity "<SiteCollection>" -SecondaryOwnerAlias "<domain>\<username>" and check if you face the same issue or not! – Mohamed El-Qassas MVP Jun 13 '17 at 23:05
  • Can you try it as i:0#.w|Domain\Username ? – Gautam Sheth Jun 14 '17 at 4:58
  • M.Qassas: I tried it. Same error. – Landfall Jun 14 '17 at 5:45
0
  • Make sure that you have set the correct Site Collection URL at Get-SPSite "<SiteCollection>"

    • I tried this on my side and get the same error but you looks like not copy the full error message

enter image description here

So run first Get-SPSite to can get the Site Collection list, then add the correct site collection URL in your Cmdlet

  • Make sure that the Owner Alias user is formatted as <domain>\<username>

Change site collection administrator CMDLET

Set-SPSite -Identity "<SiteCollection>" -SecondaryOwnerAlias "<User>"

Note: <User> is the name of the user whom you want to add in the format <domain>\<username>.

For more details check Change site collection administrators in SharePoint Server 2016

  • Site collection URL is correct. Your error message looks like mine, but the underscore is on the Set-SPSite command. InvalidData is what I'm trying to resolve. I tried the Set-SPSite command as you have above with domain\user and claims format, but still get InvalidData. Any way to check the validity of a site collection with powershell? – Landfall Jun 14 '17 at 5:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.