【发布时间】:2021-10-05 20:06:35
【问题描述】:
我向用户提出了一个问题,以披露谁有权访问特定文件夹。
我已经尝试过此脚本并获得了对文件夹的正确权限,但当前脚本包含所有子文件夹和文件并生成大量输出。
$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
我尝试在 AD 上运行单数查询,但它没有显示正确的 ACL 条目。有没有办法只查询单个文件夹/文件?像这样的查询将有助于未来的请求。
【问题讨论】:
-
去掉dir上的-recurse开关。
标签: powershell active-directory