0

We have a requirement to set SP online sites to read-only post migration to another tenant. We have Site collection admin rights and we need to do this for 100 sites a week. We need to avoid the manual effort of creating site policies. So far the 2 automated options for us are -

  1. Connect-SPOService "https://$tenant-admin.sharepoint.com"

    Set-SPOSite $siteUrl -LockState "ReadOnly"

However, we wont be provided the tenant admin rights so cant use the connect-sposervice command.

  1. Activate the site policy feature at the site collection level, create a site policy manually in each site collection and then activate the policy using the script below.

$SitePolicyToActivate = Get-PnPSitePolicy -Name $PolicyName | Select-Object -Property Name

However, we would need to avoid the manual effort of creating the site policy. We checked that the content type hub is not enabled for the tenant and we cant publish the policy across any site collections.

Is there a feasible automated way to achieve activating the site policy using script with only Site collection admin rights? Any help in this regard is appreciated.

1 Answer 1

0

Create a CSV of the site urls to be updated. Write a PowerShell script that parses the CSV and applies the Set-SPOSite command for each url.

Then provide the script to a tenant admin and have them run it for you.

That's the only way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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