Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

List ACL

Avatar of tonelm54
tonelm54 asked on
.NET ProgrammingC#
1 Comment1 Solution117 ViewsLast Modified:
Ive been asked to audit a server with regards to permissions to files and folders, so Ive come up with the idea of using C# to loop through the files and folders and write to a file what permissions each file/folder has.

So looking at the ACL documentation I can use the following code:-
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;

namespace ACL
    class Program
        static void Main(string[] args) {


        static void getACLInformation(string strFile) {
            FileInfo fInfo = new FileInfo(strFile);
            FileSecurity fSecurity = fInfo.GetAccessControl();

However when I look at fSecurity I cannot find out how to get a list of the users/groups and then what permissions they have and if its inherited or not.

Does anyone have any links to documentation or sample code of getting ACL information so I can dump it to a text file for import into a database at a later time for reporting?

Thank you
Avatar of it_saige
it_saigeFlag of United States of America imageDeveloper
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers