Home > other >  Powershell: Is there a way to enumerate access of a singular folder or file?
Powershell: Is there a way to enumerate access of a singular folder or file?

Time:10-08

A question was run by me from a user to disclose who had access to a specific folder.

I've tried this script and received the correct permissions on the folders but the current script includes all subfolders and files and generates large output.

$path = "\\fs1\" #define path to the shared folder
$reportpath ="C:\temp\ACL.csv" #define path to export permissions report
#script scans for directories under shared folder and gets acl(permissions) for all of them
dir -Recurse $path | where { $_.PsIsContainer } | % { $path1 = $_.fullname; Get-Acl $_.Fullname | % { $_.access | Add-Member -MemberType NoteProperty '.\Application Data' -Value $path1 -passthru }} | Export-Csv $reportpath

I've tried to run a singular query on AD but it doesn't show me correct ACL entries. Is there a way to only query the singular folder/file? A query like this would help for future requests.

CodePudding user response:

Thank you, enter image description here

OUTPUT- enter image description here

  • Related