Forum Discussion
Report on all sites a user is an owner or member of
- Mar 16, 2023
Hey Barry,
Unfortunately, you must be a site collection administrator (SCA) of a site to be able to have that script work successfully.
Being a Global Administrator does not grant you access to all SharePoint sites within your tenant.
The Global Admin role allows you to add your account as a site collection administrator to all the sites in your tenant, enabling you to run this script and other scripts.Your script worked beautifully for me BTW as I am a SCA for all sites in my tenant. Thanks for sharing it.
If you need to add yourself as a secondary SCA to all sites, you can use:Connect-PnPOnline -Url $SiteURL.Url -InteractiveSet-SPOUser -Site $SiteURL.Url -LoginName $UserName -IsSiteCollectionAdmin $true
Notes:- It will add the user as a secondary site collection administrator and not overwrite existing administrators including the primary administrator.
- It will work if you are not an Admin for the site but have the SharePoint admin role.
Hey Barry,
Unfortunately, you must be a site collection administrator (SCA) of a site to be able to have that script work successfully.
Being a Global Administrator does not grant you access to all SharePoint sites within your tenant.
The Global Admin role allows you to add your account as a site collection administrator to all the sites in your tenant, enabling you to run this script and other scripts.
Your script worked beautifully for me BTW as I am a SCA for all sites in my tenant. Thanks for sharing it.
If you need to add yourself as a secondary SCA to all sites, you can use:
Notes:
- It will add the user as a secondary site collection administrator and not overwrite existing administrators including the primary administrator.
- It will work if you are not an Admin for the site but have the SharePoint admin role.
- Kelly_LaForest_CDWMar 16, 2023Brass ContributorAlso want to add that Add-PnPSiteCollectionAdmin doesn't work because you must be a Site Collection Admin to run this command. It does not replace or remove existing site collection administrators.