Need to add SharePoint existing group to all the subsites in a project site

Contributor

hi,

we have a project site and under that we have almost thousand subsites with unique permission. we are facing a challenge where there is a sharepoint group with Read permission and its only assigned to site collection level. we want this group to be assigned to all subsites as well.

i got a script below and  wanted to make sure if this will do the job for us to add the already existing SP group to all subsites? Also want to make sure the email should not be broadcasted to group members when they are added to subsites.

 Also if i can add the human interaction after every loop to go one by one to make sure we are not screwing permission, that would be great.

 thanks.

 

 

Connect-PnPOnline -Url https://domain.sharepoint.com/ProjectSite
Function Get-Subsites() {  
    $subwebs= Get-PnPSubWebs -Recurse   
     foreach ($Subweb in $subwebs)  
    {  
       Set-PnPGroupPermissions -Identity 'spgroup1' -web $Subweb -AddRole Read
    }  
}   
Get-SubSites

 

 

0 Replies