Here is a quick powershell one liner commands to export the NTFS permissions for a root folders or with Sub folders.

To export for a single Folder.

Get-Childitem -path C:\MyFolder | Where-Object {$_.PSIsContainer} | Get-ACL | Select-Object Path -ExpandProperty Access | Export-CSV C:\Temp\Ntfs_single.csv

 

Export command for a folder tree

Get-Childitem -path C:\MyFolder -recurse | Where-Object {$_.PSIsContainer} | Get-ACL| Select-Object Path -ExpandProperty Access | Export-CSV C:\Temp\Ntfs_Subfolders.csv

 

 

 

7 Responses

  1. Run the below in your shell to create the folders from a csv and run the above script to replicate the NTFS permissions.

    Set-Location “D:\Sharedfolder”
    $Folders = Import-Csv C:\users.csv
    ForEach ($Folder in $Folders) {
    New-Item $Folder.Name -type directory
    }

  2. How to tackle the below error, when using “Export command for a folder tree”;
    The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

  3. Would there be any work around for this “fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.”

  4. Hi ,

    Can we import permission, We are performing NAS migration , the data is getting copied but the ACL’s are not getting propagated to the Target location
    e.g \\Fileserver1\share1 (source) to \\Storgaeshare\New_Share (Target)

    What rights are required for the user to execute the export and import activity on Source and Target.

  5. how to export a folder tree with all files , like as

    Path FileSystemRights AccessControlType IdentityReference IsInherited InheritanceFlags PropagationFlags

    K:\temp\Sunny\CRF\CRF 2017 – Identification Badge for Speakers.pdf FullControl Allow BUILTIN\Administrators TRUE None None

    thanks

Leave a Reply

Your email address will not be published. Required fields are marked *