Wednesday, October 22, 2014

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()
 #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 
  else #Copy permissions from Source to Target List
     #Reset the Inheritence in Target List

     #Copy Source list permissions to Destination List
     $SourceList.RoleAssignments | foreach-object {
#Call the function to copy list permissions 
Copy-ListPermissions "" "Documents" "Invoice"
This script copies all users and groups from the source list to 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.

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

1 comment :

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


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...