How to Export Folder Permissions to CSV using PowerShell

Quick Answer: To export folder permissions to CSV using PowerShell, open PowerShell ISE, use Get-ChildItem with Get-Acl to retrieve NTFS permissions for your target folders, then pipe the output to Export-Csv to generate your report file. This process captures folder names, user/group identities, permission levels, and inheritance status.

Quick Reference

For users who need the essential command immediately:

Get-ChildItem -Directory -Path "E:\Share80" -Recurse -Force | ForEach-Object { Get-Acl $_.FullName } | Select-Object Path, Owner, Access | Export-Csv -Path "C:\mydata\FolderPermissions.csv"

NTFS permissions are the access control settings on Windows file systems that determine which users or groups can read, write, modify, or execute files and folders. CSV export refers to outputting data to a Comma-Separated Values file format, which can be opened in spreadsheet applications like Excel for analysis and reporting.

Managing permissions is one of the most critical security concepts to implement, and it forms the foundation of effective permissions management. It is essential that only eligible users have access to critical systems and data, and so you need to ensure that their NTFS permissions include only the bare minimum necessary for their role. For organizations using permissions management software, or even those managing access manually, this task becomes vital in reducing risk exposure.

One way to generate a list of security permissions to files and shared folders on Windows servers is to get folder permissions using Microsoft PowerShell.

Using a PowerShell script, you can generate a PowerShell folder permissions report and export this to a CSV file for analysis. This makes it easier to identify users with unnecessary permissions and align them with your data security policy, streamlining the process of managing permissions effectively and minimizing the risk of a data breach.

However, the reporting of PowerShell folder permissions in this way requires a good knowledge of PowerShell scripting and the analysis can be time consuming with the amount of data produced.

In this article, we will look at how to use PowerShell to get folder permissions and then look at an alternative, more straightforward approach using the Lepide Auditor for File Server.

Get Folder Permissions and Export them to CSV Using PowerShell

Requirements: PowerShell 3.0 or later. No additional modules are required as Get-Acl and Get-ChildItem are built-in cmdlets.

  1. Open the Powershell ISE: Launch the PowerShell Integrated Scripting Environment from your Start menu or by searching for “PowerShell ISE.”
  2. Create the script to display permissions in a grid view: Use the code below (Note – Specify the path to the required folder and to where the result must be exported):
    
    $FolderPath = Get-ChildItem -Directory -Path "E:\Share80" -Recurse -Force
    $Output = @()
    ForEach ($Folder in $FolderPath) {
    $Acl = Get-Acl -Path $Folder.FullName
    ForEach ($Access in $Acl.Access) {
    $Properties = [ordered]@{'Folder Name'=$Folder.FullName;'Group/User'=$Access.IdentityReference;
    'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited}
    $Output += New-Object -TypeName PSObject -Property $Properties
    }
    }
    $Output | Out-GridViewRun the script
    
  3. Run the script: Press F5 or click the Run button to execute the script.
  4. Review the output: An example of the output is as follows
    Folder Permissions Report
  5. Export permissions to a CSV file: Use the command below to export the permissions to a CSV file,:
    
    $FolderPath = Get-ChildItem -Directory -Path "E:\Share80" -Recurse -Force
    $Output = @()
    ForEach ($Folder in $FolderPath) {
    $Acl = Get-Acl -Path $Folder.FullName
    ForEach ($Access in $Acl.Access) {
    $Properties = [ordered]@{'Folder Name'=$Folder.FullName;'Group/User'=$Access.IdentityReference;
    'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited}
    $Output += New-Object -TypeName PSObject -Property $Properties
    }
    }
    $Output | Export-Csv -path "C:\mydata\FolderPermissions.csv"
    

    An example of the CSV file is as follows:
    Folder Permissions in CSV file

Key Parameter Reference

Parameter Description
-Recurse Retrieves items from all subfolders, not just the specified path
-Force Includes hidden and system folders that would otherwise be excluded
Get-Acl Retrieves the security descriptor (access control list) for a file or folder
IdentityReference The user or group account that the permission applies to
FileSystemRights The specific permissions granted (e.g., Read, Write, FullControl)
IsInherited Indicates whether the permission is inherited from a parent folder (True/False)

Common Errors and Solutions

Error Cause Solution
“Access is denied” Insufficient permissions to read the folder’s ACL Run PowerShell as Administrator or ensure your account has Read permissions on the target folders
“Path not found” The specified folder path doesn’t exist Verify the path exists and check for typos in the folder path
Script returns empty results No subfolders exist or path is incorrect Remove -Directory parameter to include files, or verify the target path contains subfolders
CSV file is empty or malformed Special characters in folder names Add -NoTypeInformation parameter to Export-Csv for cleaner output

How Lepide Helps

An alternative method to get and export folder permissions which requires no knowledge of PowerShell scripting is to use Lepide Auditor for File Server.

By running the Permissions by Object report from the Lepide Solution, you can see all permissions for a specific object. An example is shown below:

permissions by object report

In this example, the selected object is Employee’s Account details. The report shows the permissions for the selected object and includes information on how the permissions are derived – Direct, Inherited or Indirect via a Group.

To run the report:

  • Click the Permissions & Privileges icon
  • Select Permissions by Object from the tree structure on the left
  • Choose a File Server and click Generate Report

The report is generated and can be exported to CSV format. It can also be filtered and saved

PowerShell vs. Lepide Auditor Comparison

Criteria PowerShell Method Lepide Auditor
Technical skill required Intermediate to advanced PowerShell knowledge Minimal – GUI-based interface
Time investment Higher – requires script customization and testing Lower – pre-built reports ready to run
Output format CSV (requires manual formatting for analysis) Multiple formats with built-in filtering and visualization
Scalability Limited – performance decreases with large folder structures Designed for enterprise-scale environments
Permission inheritance visibility Basic (True/False only) Detailed (Direct, Inherited, or Indirect via Group)
Ongoing maintenance Manual script updates required Automatic updates included

Frequently Asked Questions

What permissions does the script capture?

The script captures FileSystemRights (such as Read, Write, Modify, FullControl), the user or group identity, the folder path, and whether the permission is inherited from a parent folder.

How do I filter for inherited permissions only?

Add a Where-Object filter after collecting the output: $Output | Where-Object {$_.Inherited -eq $true} to show only inherited permissions, or use $false to show only explicitly assigned permissions.

What if I get “Access Denied” errors?

Run PowerShell ISE as Administrator by right-clicking and selecting “Run as administrator.” If errors persist, your account may lack permissions on specific folders—consider using a domain admin account or adjusting folder permissions.

Can I scan multiple root folders at once?

Yes, modify the $FolderPath line to include multiple paths: $FolderPath = "E:\Share80", "E:\Share81" | Get-ChildItem -Directory -Recurse -Force

Find and Export Folder Permissions with Lepide File Server Auditor
Fill in the rest of the form to
Get access to Lepide now
x