Forum Discussion
Ivan54
Jan 25, 2018Bronze Contributor
Need PowerShell Script to remove broken inheritance
Hi,
I'm having an issue with a specific document library in SharePoint Online that is being synced to a department.
This document library resides in a Classic SharePoint Site, turned into mod...
Rob Ellis
Jan 25, 2018Bronze Contributor
I've used this one successfully with SPO in the past:
https://gallery.technet.microsoft.com/office/Delete-unique-permissions-8fd47022
https://gallery.technet.microsoft.com/office/Delete-unique-permissions-8fd47022
- Ivan54Jan 25, 2018Bronze ContributorThanks Rob,
I think this should work, but unfortunately PowerShell ISE crashes after a few minutes.
The DocLib has over 6000 items, maybe that is the reason.
I'd like to limit the script to items with broken inheritances instead of the full DocLib to maybe work around the crash.
Can you help me incorporate this information into the script?
Arleta Wanat
It resets the permissions for every item. If you want to check only the ones with unique permissions, add an if condition to check for HasUniqueRoleAssignments property.
A very good explanation on how to load the values for the property is available here:
https://sharepoint.stackexchange.com/questions/126221/spo-retrieve-hasuniqueroleassignements-property-using-powershell- Jan 25, 2018I've had issues with PowerShell ISE locking up on my Win 10 PC. I switched over to the PowerShell console available through Visual Studio Code and have not had any crashes since. https://code.visualstudio.com/
- Ivan54Jan 26, 2018Bronze ContributorThanks for the tip! This seems to way more stable for this operation.