Block all personal sites (Sharepoint/OneDrive) - microsoft can't help directly

%3CLINGO-SUB%20id%3D%22lingo-sub-2073906%22%20slang%3D%22en-US%22%3EBlock%20all%20personal%20sites%20(Sharepoint%2FOneDrive)%20-%20microsoft%20can't%20help%20directly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2073906%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIs%20there%20a%20way%20to%20lock%20all%20personal%20sites.%3C%2FP%3E%3CP%3EI%20found%20a%20script%20to%20block%20one%20site%3C%2FP%3E%3CP%3EConnect-SPOService%20-Url%20%3CA%20href%3D%22https%3A%2F%2Fxxx-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fxxx-admin.sharepoint.com%3C%2FA%3E%3CBR%20%2F%3E%24siteUrl%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2Fxxx-my.sharepoint.com%2Fpersonal%2Fadelev_xxx_onmicrosoft_com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fxxx-my.sharepoint.com%2Fpersonal%2Fadelev_xxx_onmicrosoft_com%3C%2FA%3E%22%3CBR%20%2F%3E%24site%20%3D%20Get-SPOSite%20%24siteUrl%20-Detailed%3CBR%20%2F%3ESet-SPOSite%20%24site%20-LockState%20NoAccess%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIt%20works%2C%20but%20I%20have%20hundreds%20of%20sites%20to%20block.%20First%20I%20would%20need%20to%20list%20all%20sites%20and%20then%20one%20by%20one%20block%20them.%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20automate%20it%20and%20BLOCK%20all%20sites%3F%3C%2FP%3E%3CP%3EI%20want%20to%20lock%20sites%20temporarily.%20This%20lock%20prevent%20users%20that%20has%20a%20personal%20site%20to%20use%20them%20(new%20ppl%20are%20blocked%20by%20MySite%20setting).%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20contacted%20Microsoft%20directly%20and%20they%20provided%20me%20with%20some%20data%20-%20they%20told%20me%20that%20I%20should%20use%20ForEach%2C%20but%20I%20have%20no%20idea%20how%20to%20use%20it%2C%20and%20they%20won't%20help%20me%20any%20further%20cause%20it%20is%20against%20some%20policy.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2073906%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hello,


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.

0 Replies