Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@RobsonAutomator
Last active August 21, 2017 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobsonAutomator/6f214b2163de29da48513b1bf305f2da to your computer and use it in GitHub Desktop.
Save RobsonAutomator/6f214b2163de29da48513b1bf305f2da to your computer and use it in GitHub Desktop.
Copies a Sitecore item access rights from one identity to another identity.
<#
.Synopsis
Copies an item access rights from one identity to another identity.
.EXAMPLE
Copy-ItemAcl -FromIdentity 'SUPER\ROBSONAUTOMATOR' -ToIdentity 'LAZY\ONE' -Path "/sitecore/content/Home"
.Author
Robert Senktas
#>
function Copy-ItemAcl{
[CmdletBinding()]
param(
# FromIdentity User name including domain
[Parameter(Mandatory=$true)]
[string]$FromIdentity,
# ToIdentity User name including domain
[Parameter(Mandatory=$true)]
[string]$ToIdentity,
[Parameter()]
# Path A path to the Sitecore item
[string]$Path
)
$acls = Get-ItemAcl -Path $Path -Identity $FromIdentity
$acls | % {Add-ItemAcl -Path $Path -Identity $ToIdentity -AccessRight $_.AccessRight -SecurityPermission $_.SecurityPermission -PropagationType $_.PropagationType }
#Get-ItemAcl -Path $Path -Identity $ToIdentity
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment