To retrieve a file's access control list (ACL) in PowerShell, you simply use the Get-Acl cmdlet with the file path as the argument. This directly returns the security permissions, ownership, and inheritance rules—no extra steps required. The output includes details like which users/groups have read/execute permissions and whether the file is inheritable, making it essential for troubleshooting access issues or auditing system security.
What You'll Need
- A Windows PC with PowerShell installed (built into Windows 10/11 Pro/Enterprise)
- Administrator privileges to inspect some system files (for local files, regular users can access their own)
- The target file or folder path (e.g.,
C:\Documents\file.txt) - Optional: A text editor to review the output (not strictly needed but helpful for formatting)
Step-by-Step
- Open PowerShell as Administrator
- Press
Win + Xon Windows 10/11, then selectWindows Terminal (Admin)orPowerShell (Admin). - If prompted by UAC, click
Yesto grant permissions. Note: Regular users can only inspect permissions on their own files.
- Press
- Run the Get-Acl cmdlet
- Paste this command for a file:
Get-Acl -Path "C:\path\to\file.txt"Replace"C:\path\to\file.txt"with your actual file path. For folders, use-Include:Get-Acl -Path "C:\path\to\folder" -Recurse - For immediate feedback, add
-ErrorAction Stopto halt on errors:Get-Acl -Path "C:\path\to\file" -ErrorAction Stop
- Paste this command for a file:
- Interpret the output
- The output shows details like:
Access: Permissions granted (e.g., ReadData, WriteData, FullControl).Inheritance: Whether the ACL is inherited from parent folders.Owner: The security principal with ownership rights.AccessControlList: Detailed permission entries for each user/group.
- Example for a file:
IdentityReference : BUILTIN\Administrators AccessAllowed : ReadData, ReadAttributes, ListFolder, WriteDacl, WriteOwnerThis means administrators have full control, including modifying permissions.
- The output shows details like:
Common Mistakes
- Running PowerShell without admin rights
- Regular users can only see their own folder/file permissions. For system files, you must run PowerShell as Administrator. If you get errors like
Access is denied, you need elevation. - Specifying the wrong path
- Typos in paths (e.g.,
C:\wrong\to\path) return empty results. Always verify the path exists before running the command. - Using non-existent commands
-
Get-ACLis the correct cmdlet. TypingGet-FileACL(missing the double 'A') will return nothing. - Ignoring Recurse for folders
- For folders with subfolders/subfiles, use
-Recurse. Without it, the command only checks the top-level folder.
Tips
- Export results to CSV
Use
Get-Acl -Path "C:\file" | Export-Csv -Path "ACL_Export.csv" -Forceto save the output for later review or sharing. - Filter specific permissions
Add
-MemberType Ownerto see only ownership data:Get-Acl -Path "C:\file" -MemberType Owner - Compare ACLs across systems
Use
Compare-Objectto highlight differences between two files' ACLs:Get-Acl C:\file1 | Compare-Object (Get-Acl C:\file2) -Property AccessAllowed - Check for special permissions
Look for
GenericAllorModifyentries in theAccessAllowedblock—these indicate broader access rights.
Troubleshooting
- Error: "Access is denied"
- If you’re not an admin, open PowerShell as Administrator or request elevated access for the file.
- Check if you own the file: Run
icacls "C:\file"in Command Prompt. If you see your name but not the expected permissions, you may need to adjust ownership first.
- Empty output when the file exists
- Verify the path is correct. For hidden system files (e.g.,
C:\Windows\System32\config\sam), you’ll need admin rights and may need to disable UAC temporarily. - Use
Test-Pathto confirm the file exists:Test-Path "C:\path\to\file"
- Verify the path is correct. For hidden system files (e.g.,
- Slow performance on large folders
- Use
-Depth 1instead of-Recurseto limit checks to immediate subfolders:Get-Acl -Path "C:\large\folder" -Depth 1 - For systems with 1000+ files, consider exporting ACLs to CSV and processing them in batches.
- Use
- ACL shows no permissions
- NTFS permissions may be disabled. Check with
icacls "C:\file" /statusin CMD. If disabled, you’ll need to enable them viafsutilor Group Policy. - For network drives, ensure the mapped drive has proper permissions before querying.
- NTFS permissions may be disabled. Check with
Frequently Asked Questions
How do I see ACLs for a network folder?
For network folders, use the server’s path (e.g., \\Server\Share\File) or map the drive first. Example:
Get-Acl -Path "\\Server\Share\File"
If the server is remote, you may need to add -ErrorAction SilentlyContinue to avoid connection errors.
Can I modify ACLs after retrieving them?
Yes! Use Set-Acl to change permissions. For example:
Set-Acl -Path "C:\file" -IdentityReference "DOMAIN\Users\John" -AccessRuleSet "ReadData, WriteData"
Why does Get-Acl show "Inheritance" as "None" for a folder?
This means the folder’s ACL is not inherited from its parent. Inheritance is controlled via the folder’s Security tab in File Explorer (right-click > Properties > Security). To disable inheritance, select Deny inheriting permissions.
How do I reset all permissions to default?
For a folder, use:
icacls "C:\folder" /reset /T
This restores default NTFS permissions. For files, this isn’t possible—only the owner can remove all permissions.
Does Get-Acl work on Linux files?
No. Get-Acl is Windows-specific. On Linux, use tools like getfacl (from the ACL package) or ls -Z for extended attributes.
How can I see ACLs for Active Directory users?
For AD groups/users, query their object ACLs via Active Directory Module for PowerShell:
Get-ADPrincipalPermission -Identity "DOMAIN\Users\John" -ObjectPath "OU=Users,DC=domain,DC=com" -ListAcl
This requires the ActiveDirectory module and proper permissions.
Note: For production environments, always test changes in a non-production environment first.