Bootstrap FreeKB - PowerShell - Display file or directory permissions using the Get-Acl cmdlet
PowerShell - Display file or directory permissions using the Get-Acl cmdlet

Updated:   |  PowerShell articles

The Get-Acl cmdlet can be used to display the ownership and permissions of files and directories. In this example, the ownership and permissions of foo.txt is displayed.

Get-Acl C:\Users\johndoe\foo.txt

 

Which should return something like this.

Path            Owner        Access                                                                                                          
----            -----        ------                                                                                                          
foo.txt         APPL\johndoe NT AUTHORITY\SYSTEM Allow  FullControl..

 

Since the full output is not displayed, this cmdlet is often piped through Format-List.

Get-Acl C:\Users\johndoe\foo.txt | Format-List

 

Which should return something like this.

Path   : Microsoft.PowerShell.Core\FileSystem::C:\Users\johndoe\foo.txt
Owner  : APPL\johndoe
Group  : APPL\Domain Users
Access : NT AUTHORITY\SYSTEM Allow  FullControl
         BUILTIN\Administrators Allow  FullControl
         APPL\johndoe Allow  FullControl
Audit  : 
Sddl   : O:S-1-5-21-2935017146-1175072803-3606478167-175590G:DUD:(A;ID;FA;;;SY)(A;ID;FA;;;BA)(A;ID;FA;;;S-1-5-21-2935017146-1175072803-3606478167-175590)

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 8a39ed in the box below so that we can be sure you are a human.