SoFunction
Updated on 2025-03-10

Powershell implements cloning NTFS file system permissions

All versions are supported.

Below is a simple code to obtain permissions to a folder or program to assign permissions to another object. Note that the paths must all exist:

Copy the codeThe code is as follows:

$FolderToCopyFrom = 'C:\folder1'
$FolderToCopyTo = 'C:\folder2'
 
$securityDescriptor = Get-Acl -Path $FolderToCopyFrom
Set-Acl -Path $FolderToCopyTo -AclObject $securityDescriptor

The cloning security description requires administrator permissions. Note that the security rules for the first directory will all overwrite the second directory.