Direct Inward Dialing: +1 408 916 9393
Export NTFS permissions to a CSV file with Windows File Explorer and PowerShell by reading the access control list (ACL) of each folder with Get-Acl. This guide covers the steps, their limitations, and the ADManager Plus alternative.
File Explorer displays the NTFS permissions of a folder but has no option to save them as a CSV file, so the steps below are only for viewing the permissions.
$RootPath = "\\FileServer\Share"
$OutFile = "D:\Reports\NTFS-Permissions-$(Get-Date -Format yyyyMMdd).csv"
$Folders = @(Get-Item -LiteralPath $RootPath) + @(Get-ChildItem -LiteralPath $RootPath -Directory -Recurse -ErrorAction SilentlyContinue)
$Folders | ForEach-Object {
$FolderPath = $_.FullName
(Get-Acl -LiteralPath $FolderPath).Access | Select-Object @{Name = "FolderPath"; Expression = { $FolderPath }}, IdentityReference, FileSystemRights, AccessControlType, IsInherited, InheritanceFlags, PropagationFlags
} | Export-Csv -Path $OutFile -NoTypeInformation
Open the CSV file. Each row shows the folder path, the user or group (IdentityReference), the rights granted (FileSystemRights), whether the entry allows or denies access (AccessControlType), and whether it is inherited (IsInherited). The CSV lists the NTFS access control entries defined on each folder. It does not calculate the effective permissions of individual users.
| Parameter | Description |
|---|---|
| -Path | Specifies the path of the file or folder with the security descriptor being retrieved |
| -LiteralPath | Specifies the path exactly as typed, without wildcard interpretation |
| -InputObject | Retrieves the security descriptor of an object that has no path |
| -Audit | Includes the audit data (system ACL) of the resource in the output |
| Parameter | Description |
|---|---|
| -Path | Specifies the location to list |
| -LiteralPath | Specifies the location exactly as typed, without wildcard interpretation |
| -Directory | Returns folders only |
| -Recurse | Returns items from the specified location and all its subfolders |
| -Depth | Limits the number of subfolder levels returned when used with -Recurse |
| Parameter | Description |
|---|---|
| -Path | Specifies the location of the CSV file |
| -NoTypeInformation | Omits the type information line from the file in PowerShell 5.1 |
| -Append | Adds rows to an existing CSV file instead of overwriting it |
| -Delimiter | Specifies the character that separates the values |
| -Encoding | Specifies the character encoding of the file |
This script lists every non-special share on the file server along with its share permissions and writes them to a CSV file:
$OutFile = "D:\Reports\Share-Permissions.csv"
Get-SmbShare -Special $false | ForEach-Object {
$Share = $_
Get-SmbShareAccess -Name $Share.Name |
Select-Object Name, @{Name = "Path"; Expression = { $Share.Path }},
AccountName, AccessControlType, AccessRight } | Export-Csv -Path $OutFile -NoTypeInformation
To achieve this result in ADManager Plus:
This script registers a weekly task that runs the export script from the PowerShell steps, saved as C:\Scripts\Export-NtfsPermissions.ps1:
$Action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument '-NoProfile -File "C:\Scripts\Export-NtfsPermissions.ps1"'
$Trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -At 2am
$Cred = Get-Credential -UserName "CORP\svc-ntfsreport" -Message "Account that runs the export"
Register-ScheduledTask -TaskName "NTFS Permissions Export" -Action $Action -Trigger $Trigger -User $Cred.UserName -Password $Cred.GetNetworkCredential().Password
To get the same result with ADManager Plus, use scheduled reports:
ADManager Plus shows an alert if a mail server is not configured. Specify the server in the Email Server/SMS Gateway settings under Admin > General Settings > Server Settings before saving the schedule.
Skip the recursion and pass the folder directly to Get-Acl, then export the access entries:
(Get-Acl -LiteralPath "\\FileServer\Share\Finance").Access | Select-Object IdentityReference, FileSystemRights, AccessControlType, IsInherited | Export-Csv -Path "D:\Reports\Finance-Permissions.csv" -NoTypeInformation
NTFS permissions are stored on the files and folders themselves and apply to both local and network access. Share permissions apply only to access through the network share. When both apply, the more restrictive of the two decides the access. ADManager Plus reports on both through its NTFS and share permissions reports.
Windows stores share permissions as binary security descriptors under HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares\Security. Exporting that key creates a REG file that cannot be read as a permissions list and is not a CSV. Use Get-SmbShare and Get-SmbShareAccess instead, as shown in Use case 1, or run the Shares in the Servers report in ADManager Plus.
When an account is deleted from Active Directory, its entry stays in the folder's ACL, and Windows can no longer resolve it to a name. You can revoke these entries with the file permissions management feature in ADManager Plus.
Yes. The Permissions for Folders report checks the specified path (or several paths added with the + icon) and the subfolders down to the folder level you select. The NTFS Reports help page describes each report and its options.
The account running the script cannot read the security settings of the folder. Run the script with an account that has Read permissions on the folder tree, such as a member of the file server's local Administrators group.
The path has a typo, or the share name is wrong. Mapped drive letters are also unavailable in an elevated PowerShell session, so use the full UNC path in $RootPath.
-ErrorAction SilentlyContinue hides the folders that Get-ChildItem cannot open. Remove it temporarily to see which folders fail, then run the script with an account that can read them.
Get-SmbShare and Get-SmbShareAccess belong to the SmbShare module. Run the script on the file server, or point the cmdlets at it with the -CimSession parameter.
Check the Last Run Result column in Task Scheduler. The usual causes are a changed or expired password for the account, missing permissions for the account to log in as a batch job, or no write access to the output folder.