Jan 19 2021 04:02 AM
Is there a way to lock all personal sites.
I found a script to block one site
Connect-SPOService -Url https://xxx-admin.sharepoint.com
$siteUrl = "https://xxx-my.sharepoint.com/personal/adelev_xxx_onmicrosoft_com"
$site = Get-SPOSite $siteUrl -Detailed
Set-SPOSite $site -LockState NoAccess
It works, but I have hundreds of sites to block. First I would need to list all sites and then one by one block them.
Is there a way to automate it and BLOCK all sites?
I want to lock sites temporarily. This lock prevent users that has a personal site to use them (new ppl are blocked by MySite setting).
I contacted Microsoft directly and they provided me with some data - they told me that I should use ForEach, but I have no idea how to use it, and they won't help me any further cause it is against some policy.
Jan 19 2021 09:22 AM
SolutionYou can use the Get-SPOSite cmdlet to list all "personal" sites:
$ODFBsites = Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'"
then loop over each site and change the state:
$ODFBsites | % {Set-SPOsite $_.Url -LockState NoAccess }
Jan 19 2021 10:52 AM
Thank you very much.
Could you please answer one more question?
How can I check if the status changed? How can I list all sites LockState :(
I just cannot make it work :(
Jan 20 2021 12:02 AM
For that, run the Get-SPOSite cmdlet with the -Detailed switch.
Jan 24 2021 11:12 AM
Unfortunately it was too hard to do for me.
Thanks for trying to help this useless piece of junk (me)
Jan 19 2021 09:22 AM
SolutionYou can use the Get-SPOSite cmdlet to list all "personal" sites:
$ODFBsites = Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'"
then loop over each site and change the state:
$ODFBsites | % {Set-SPOsite $_.Url -LockState NoAccess }