I am using following Powershell script to break the folder permissions inside the Record Libraries:

    $webUrl = 'http://intranet'
    $web = Get-SPWeb $webUrl;
    $SPBaseTypeDocumentLibrary = [Microsoft.SharePoint.SPBaseType]::DocumentLibrary
    $lists = $web.GetListsOfType($SPBaseTypeDocumentLibrary);
    foreach ($list in $lists)
    if ($list.BaseTemplate.ToString() -eq "1302")
    $folders = $list.Folders
    foreach ($spFolder in $folders)
        # Add claims to folder
        $folderName = $spFolder.Name
        $claimToken = "c:0-.t|clientcontracts|" + $folderName
        $claimUserDisplayName = "Claim User " + $folderName  
        $roleAssignment = New-Object microsoft.sharepoint.SPRoleAssignment($claimToken,"",$claimUserDisplayName,"")


The issue is that the script is gets very sluggish. I have about 100 Libraries and each library contains 1000 folders. Is there any way to improve the performance of this script? How can we break permissions of folders in batches?


This really isnt a PowerShell issue. Instead it clearly stipulates why setting unique permissions (especially alot of different ACL's) on items/folders in a SharePoint list is not recommended, especially for large lists.

I would recommend rethinking the design...

@james-love also made a couple of posts on his blog on this issue



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.