Skip to main content
Copy-ObjectPermissions

Copy permissions between SharePoint objects with PowerShell with some limitations

Updated over 2 months ago

Command

Copy-ObjectPermissions

Description

With Copy-ObjectPermissions, you can copy permissions from SharePoint objects, such as sites and documents, or file share folders or documents.

You can only copy permissions across environments that use the same Active Directory (AD)/ Entra ID domain and identical SharePoint groups.

Limitations

Copy-ObjectPermissions is limited, and it will not:

  • Verify if your users or groups exist at the destination. No errors or warnings will be displayed if they don't.

  • Add missing group members from the source to the group at the destination.

Examples

Copy site permissions

$site1 = Connect-Site "http://myfarm/sites/mysite1"
$site2 = Connect-Site "http://myfarm/sites/mysite2"
Copy-ObjectPermissions -Source $site1 -Destination $site2

Copy File Share permissions to multiple SharePoint destinations

$sourcefile = Get-Folder -Path "C:\Temp"
$site1 = Connect-Site "http://farm1/sites/mysite1"
$site2 = Connect-Site "http://farm2/sites/mysite2"
$list1 = Get-List -Site $site1 -Name "Documents"
$list2 = Get-List -Site $site2 -Name "Documents"
$spfile = Get-File -List $list1 -Path "Files/file.txt"
$folder = Get-Folder -List $list2 -Path "Folder Path"
Copy-ObjectPermissions -Source $sourcefile -Destination $site1,$site2,$list1,$list2,$spfile,$folder

Copy MySite library permissions to OneDrive

$MySite = Connect-Site "http://myfarm/personal/myusername"
$PersonalDocuments = Get-List -Site $MySite -Name "Personal Documents"
$OneDrive = Connect-Site "http://mytenant-my.sharepoint.com/personal/myusername"
$OneDriveDocuments = Get-List -Site $OneDrive -Name "Documents"
$DocumentsFolder = Get-Folder -List $OneDriveDocuments -Path "Personal Documents"
Copy-ObjectPermissions -Source $PersonalDocuments -Destination $DocumentsFolder

Syntax

Copy-ObjectPermissions
-Source <ISecurable>
-Destination <ISecurable[]>
[-MappingSettings <MappingSettings>]
[-TaskName <String>]

Parameters

-Destination <ISecurable[]>

Specifies the (non File System) destination objects that the copied permissions will be applied to.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-MappingSettings <MappingSettings>

Specifies the mapping settings.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Source <ISecurable>

Specifies the source object whose permissions will be copied.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-TaskName <String>

Specifies a name for the task.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?