Copy List Permissions in SharePoint using PowerShell

Ever wanted to clone permissions between SharePoint lists or Libraries? Well, Here is the nifty PowerShell script to copy permissions between SharePoint lists:

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

#PowerShell Function to copy permissions between Lists in SharePoint
Function Copy-ListPermissions()
{
 param(
     $WebURL,
     $SourceListName,
     $TargetListName
 )
 #Get the Web
 $Web = Get-SPweb $WebURL

 #Get Source and Target Lists
 $SourceList = $Web.lists[$SourceListName]
 $TargetList = $Web.lists[$TargetListName]

 #if permissions are Inherited in Source, apply it in Target list 
  if($SourceList.Permissions.Inherited)
   {
      $TargetList.ResetRoleInheritance()
   }
  else #Copy permissions from Source to Target List
  {
     #Reset the Inheritence in Target List
     $TargetList.BreakRoleInheritance($false)

     #Copy Source list permissions to Destination List
     $SourceList.RoleAssignments | foreach-object {
     $targetList.RoleAssignments.Add($_)
      }
  }
 $TargetList.Update()
}
#Call the function to copy list permissions 
Copy-ListPermissions "https://sharepoint.crescent.com/sites/operations/us" "Documents" "Invoice"

This script copies all users and groups from the source list to the target list. Any custom permissions already applied on the target list will be lost! The above method can be used to copy permissions between SharePoint list items and sites.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Copy List Permissions in SharePoint using PowerShell

  • where do we input site address, source list name, and destination list name?

    Reply
    • Just pass them as parameters to “Copy-ListPermissions” function! As in Line#36

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *