Get Folder Permissions using PowerShell

Recently someone ask me how to get folder permissions using PowerShell on a specified (remote) computer and path. I figure out that this can be done using the GUI, but I realize that this can be a lot of work. Windows stores the information related to File permissions for an object in Access Control Lists (ACLs). So I jumped into PowerShell to get this job done.

We will be using Get-ACL to retrieve the required information.  If we want to find the permissions for the sub folders in C:\Windows, we using Get-ChildItem, so run the following command:

Note: we have used PsIsContainer as a filter. The Where-Object {($_.PsIsContainer)} will make sure only the directory is shown. Without this filter, all the files and folders will show up on your result.

If you want more Get-ACL properties, just run the following PowerShell command:

To get folder permissions for a remote computer or server we using the Get-Acl cmdlet. The Get-Acl cmdlet retrieves the security descriptor (Access Control List) for a file, folder, or registry key.

PowerShell function

Save the PowerShell function above to Get-FolderPermissions.psm1 and save it to: C:\Program Files\WindowsPowerShell\Modules\Get-FolderPermissions.

To get the folder permissions locally or remotely open PowerShell and just run the following command:

To output the results to a text file, just run the following command:

Output:

I really like to hear what you have to say about this article:

  • Was this article helpful for you or do you have any questions?
  • Do you have additions, suggestions or any other ideas?
  • Just let me know by leaving a comment below.

Thank you for spending some time at my site and in my blog. I hope you come to visit again soon 😉

About Lex van der Horst 201 Articles
Techwire

Be the first to comment

Leave a Reply