Quantcast
Channel: Spiceworks Community
Viewing all articles
Browse latest Browse all 6732

Count Users ACL

$
0
0

Greetings---

I am attempting to create a powershell script that will allow me to import a list of folders and will then display a list and count of all users who have access to that folder.

At the moment, I am working with:

Powershell
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$violations=Import-Csv"c:\folderlist.csv"foreach($pathin$violations){$acl=Get-Acl-Path$path.Access_Path$list=$acl.Access|ForEach-Object{$_.identityReference.value}$path.Access_Path$list$list.count}

Which works wonderfully, except there are nested groups.

I would ideally like to be able to parse the nested group and give me a count of users.
Sample output:

Text
1
2
3
4
5
6
7
8
H:\Path_To_Folder\Folder
DOMAIN\group1
DOMAIN\group2
DOMAIN\user1
DOMAIN\user2
BUILTIN\Administrators
NT AUTHORITY\SYSTEM
6

In the sample above, DOMAIN\group1 has 10 users and DOMAIN\group2 has 5 users... 
Thus, H:\Path_To_Folder\Folder would have a user count of 19


Viewing all articles
Browse latest Browse all 6732

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>