ICACLS – Copy and Restore NTFS permissions

      No Comments on ICACLS – Copy and Restore NTFS permissions

ICACLS is a very handy tool for folks who manage file shares.
It allows to backup and restore a folder or set of folders/files permissions. There are several ways to do this, but by far ICACLS is my favorite one.

To Save permissions use:
icacls FolderToBackup /save ACLBackup.acl /T /C /Q

To Restore use:
icacls FolderToRestore /restore ACLBackup.acl /T /C /Q

Tip: Personally i like to avoid full paths as in “D:\share\departments”. Instead i prefer to CD into “D:\share\Departments” and then run icacls using . as the path. The reason behind it is that the full path is saved in the ACL file. This means if you want to restore permissions on the files in a different location, that would have to be the same as the one taken to back them up in the first place.
So in our example, if we want to restore permissions on E:\departments we would be in a tough spot!

That said, lets go and look at the options used:

  • FolderToBackup – Name is self explanatory, CD into it and use . instead
  • /save – Will tell icacls to save permissions
  • /restore – Will tell icacls to restore permissions
  • /T – Go through all folders recursively
  • /C – Continue even on failures
  • /Q – Only print errors (handy specially for logging)

Leave a Reply

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