Skip to main content
Copy Object Permissions
Updated this week

Command

Copy-ObjectPermissions

Description

The command to copy permissions from a SharePoint site, list, file, or folder or a File Share file or folder to one or multiple destination SharePoint sites, lists, files, or folders.

Index

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?