Tan See Youu
Tan See Youu

Reputation: 74

.NET- how to get full list of users with access to a share folder?

I'm looking for an efficient way to look for all users with access to a share folder. I think probably need to combine suggestions from this post See if user is part of Active Directory group in C# + Asp.net and how to check if specific user having access to a shared folder location using C#

I found that using AuthorizationRuleCollection can only find the groups and user having access to the folder but not the group members. If a folder is only granted to user group but not individual user account, I can't find which user is having access to this folder. In that case I have to check all the members(child) inside those user groups.

It's fine to loop through all groups and list down the group members(child), just wish to find out if there is a more efficient/better way to get a full list of users immediately? (doesn't necessarily to be a .NET method, can be any such as command prompt or powershell)

Thanks

Upvotes: 0

Views: 2305

Answers (1)

Mahesh Malpani
Mahesh Malpani

Reputation: 1989

using command prompt you can get all users with access to share folder

cacls <Foldername>

From c# you can invoke cmd using process and then get the output also

Upvotes: 1

Related Questions