Skip to the content.

EXPORT ACL TO EXCEL FILE


About

This is a PowerShell script I made in order to audit the access rights in my company’s shared folders.
Thanks to the ImportExcel module by dfinke, the ACL are exported to one or more files (you choose), with a worksheet for every folder given in parameter.
Written by Benoît Flache, 2022.

screenshot

Features

Prerequisites

How to use

Parameters

-out is where you want to save the Excel file. For example : C:\document.xlsx

-scan is either :

-depth is the recursive depth. Default : 1.

-help to print help and command examples

-q to disable output to console

-style to select the table style. Possibilities are listed in file help.txt

-split if you want to scan several folders and have the results saved in different files.
If you enabled this option, you have to give a folder and not a filename in the -out parameter.
The files are named like SCANNED_DIRECTORY_NAME.xlsx.
If there is already a file named like this in the folder, the results will be added as a second sheet in the existing file.

-fullnames to export the full names instead of the logins

-noninherited if you want to export only the non-inherited access rights. Helps readability in large scans.

-onlyusers if you want to export only the usernames and omit the group names.

-nobuiltin to exclude BUITIN accounts from the report

-nosystem to exclude the SYSTEM account from the report

txt file

To scan several folders in one shot, you can create a txt file containing all those folders separated by a line break For example :

folders.txt

K:\first\folder\to\scan
C:\second\folder
M:\

Examples

.\export-acl.ps1 -scan M:\path\to\directory -out C:\document.xlsx
.\export-acl.ps1 -scan C:\path\to\list.txt -out C:\document.xlsx
.\export-acl.ps1 -scan C:\path\to\list.txt -out C:\document.xlsx -depth 2
.\export-acl.ps1 -help
.\export-acl.ps1 -scan M:\path\to\directory -out C:\document.xlsx -style Medium3
.\export-acl.ps1 -scan C:\path\to\list.txt -out C:\directory -split -depth 0
.\export-acl.ps1 -scan M:\path\to\directory -out C:\document.xlsx -depth 5 -noninherited -fullnames -nobuiltin -nosystem

GitHub repository
ImportExcel GitHub repo

Improvements

I will try to improve this script, however if you have any questions or ideas on how to improve the code with new features or redesigning the functions, structure or in general code quality you are more than welcome :)