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

  1. Open PowerShell as Administrator
    • Press Win + X on Windows 10/11, then select Windows Terminal (Admin) or PowerShell (Admin).
    • If prompted by UAC, click Yes to grant permissions. Note: Regular users can only inspect permissions on their own files.
  2. Run the Get-Acl cmdlet
    1. 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
    2. For immediate feedback, add -ErrorAction Stop to halt on errors: Get-Acl -Path "C:\path\to\file" -ErrorAction Stop
  3. Interpret the output
    1. 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.
    2. Example for a file: IdentityReference : BUILTIN\Administrators AccessAllowed : ReadData, ReadAttributes, ListFolder, WriteDacl, WriteOwner This means administrators have full control, including modifying permissions.

Common Mistakes

  1. 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.
  2. 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.
  3. Using non-existent commands - Get-ACL is the correct cmdlet. Typing Get-FileACL (missing the double 'A') will return nothing.
  4. Ignoring Recurse for folders - For folders with subfolders/subfiles, use -Recurse. Without it, the command only checks the top-level folder.

Tips

  1. Export results to CSV Use Get-Acl -Path "C:\file" | Export-Csv -Path "ACL_Export.csv" -Force to save the output for later review or sharing.
  2. Filter specific permissions Add -MemberType Owner to see only ownership data: Get-Acl -Path "C:\file" -MemberType Owner
  3. Compare ACLs across systems Use Compare-Object to highlight differences between two files' ACLs: Get-Acl C:\file1 | Compare-Object (Get-Acl C:\file2) -Property AccessAllowed
  4. Check for special permissions Look for GenericAll or Modify entries in the AccessAllowed block—these indicate broader access rights.

Troubleshooting

  1. 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.
  2. 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-Path to confirm the file exists: Test-Path "C:\path\to\file"
  3. Slow performance on large folders
    • Use -Depth 1 instead of -Recurse to 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.
  4. ACL shows no permissions
    • NTFS permissions may be disabled. Check with icacls "C:\file" /status in CMD. If disabled, you’ll need to enable them via fsutil or Group Policy.
    • For network drives, ensure the mapped drive has proper permissions before querying.

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.