Powershell to get ACL for a folder and recurse it’s subfolders

Try this command to get all files and folders of acl by get-childitem and get-acl then export to a csv file.

Get-ChildItem "X:\Share" -recurse | Get-Acl -Exclude *.* | export-csv -encoding utf8 c:\djk\share_folder_permission.csv

Or only get all folders of acl. So we must to use -Exclude *.* that like filename expression.

Get-ChildItem "X:\Share" -recurse -Exclude *.* | Get-Acl | export-csv -encoding utf8 c:\djk\share_folder_permission.csv

Final we limit depth for search subfolders by search path like 「\*\*\*」,it limit two depths for search. And limit search just limit folders.

Get-ChildItem "X:\Share\*\*\*" -Exclude *.* | Get-Acl | export-csv -encoding utf8 c:\djk\share_folder_permission.csv

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s