Power shell script to list all files and folder permissions recursively RRS feed

  • Question

  • Hi All,

    I am looking for a powershell script to perform the following operations.
    1) To list the folder and file permissions(Allow,Deny both) recursively in a given folder.
    2) List out all the files and folders which are having the deny permission or having only the read access (or) only the write access. Basically the folder should have Read,Execute,Write permissions. Else we have to flag that file/folder name.

    I had written a batch script for the same which does this task using icacls.exe output, but this script takes lot of time to recursively parse all the files ( ~1 lakh files).

    Please help me with the powershell script for the same.


    Wednesday, May 28, 2014 7:21 AM

All replies

  • Wrong Forum. This forum is for System Center Data Protection Manager.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, May 28, 2014 7:37 AM
  • Try this module:

    After importing the module, you can run something like this:
    dir c:\folder -recurse | Get-AccessControlEntry

    That output can be exported to a CSV for later viewing. You can also provide some parameters to Get-AccessControlEntry to limit the results:
    dir c:\folder -recurse | Get-AccessControlEntry -FileRights Write
    dir c:\folder -recurse | Get-AccessControlEntry -AceType AccessDenied
    dir c:\folder -recurse | Get-AccessControlEntry -AceType AccessAllowed -FileRights Write

    Wednesday, June 18, 2014 6:47 PM