

A second ForEach loop formats each access control entry (ACE) into an ordered list, pulling out just the information that we need, making the results easy to read. The script below puts the folder hierarchy into a variable ($FolderPath) and then passes each folder to Get-Acl in the first ForEach loop. So, if you want to know the permissions set on all folders in a directory tree, you need to use the Get-ChildItem cmdlet with the -Recurse parameter to list all the folders in the tree and then pass the results to Get-Acl using a ForEach loop. Get-Acl cannot recursively return all the permissions of folders in the hierarchy. The example below gets the permissions set on the C:\temp folder and all the available properties.

The PowerShell Get-Acl cmdlet can be used to return permissions on objects like files, folders, and registry keys. How to use Get-Acl cmdlet to Get an NTFS Permissions Report Speed up privacy and data subject access requests with eDiscovery.

