Repair SharePoint List Permissions (Break & Copy)
Use at your own risk. Test in non-prod first.
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/YourSite -Interactive
$lists = Get-PnPList
foreach ($l in $lists) {
Write-Host "Processing $($l.Title)"
Set-PnPList -Identity $l -BreakRoleInheritance -CopyRoleAssignments -EnableSharingForGuestUsers:$false -ErrorAction SilentlyContinue
}
