Wednesday, February 4, 2015

Read and Export Folder ACL using Powershell

Good day
I have a small old file server with 2 TB of users data and I dont which users have which permission on the folder structure.
There are some tools but most of them are paid, but even in some paid tools I wont be able to do some filtering like exclude Inherided Folder or do not include some certain account like "System or Creator Owner...", so why to buy anything when there is PowerShell
I wrote a script that will read all the folder tree and then export it to csv file
This script have 4 Parameters

.PARAMETER $PathToScan Write the Folder Path you want to scan.PARAMETER $PathToSaveResultAfter Finish scanning the Script will save result to CSV, Please write the full path to store the result.PARAMETER $IncludeInheritedFolderWhether or not to include Inherited Objects, Accpted values $True or $False.PARAMETER $SysBuiltinWhether to include System account "NT Authority and Builtin" accounts, Accpted values $True or $False

To use the Script:
GetACL.ps1 -PathToScan C:\FolderToScan-PathToSaveResultC:\MyOutput.csv-IncludeInheritedFolder$TRUE or $FALSE-SysBuiltin$TRUE or $FALSE

Always make sure you are running the lastest version of PowerShell and .Net Framework