A family of Microsoft on-premises document management and storage systems.
Hi, @adil ,
I assume your are using SharePoint On-Premise. Please have a try with the script below
#Configuration Parameters
$WebURL="siteURL"
#Get the List
$Web = Get-SPWeb $WebURL
$Lists = $web.Lists
Foreach($List in $Lists)
{
#Return only document libraries
if ($List.baseTemplate -eq "DocumentLibrary")
{
#Check if the library has unique permission
if ($List.HasUniqueRoleAssignments -eq $False)
{
$List.BreakRoleInheritance($True)
Write-host $List.Title "Stopped Inheriting Permissions from the parent." -f Green
}
else
{
write-host $List.Title "List is already using Unique Permissions!" -f Red
}
}
}
If the answer is helpful, please click Accept Answer and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.