In PowerShell when using Get-Acl how can I show all members belonging to a group instead of the group itself?
So:
Get-ChildItem C:\ | where-object {($_.PsIsContainer)} | Get-Acl | select path -ExpandProperty Access
Shows something like this:
Path : Microsoft.PowerShell.Core\FileSystem::C:\Test
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited : False
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
Path : Microsoft.PowerShell.Core\FileSystem::C:\Test
FileSystemRights : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : BUILTIN\Users
IsInherited : False
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
Instead I want it to list all users belonging to Administrators/Users with their permission for each folder and discard the group.
Also how can I add Convert-Path to the select path statement so that path displayed is only C:\Test?
Thanks!
I wasn't able to solve it with linked post and/or the PowerShell Access Control module, still only got groups. So in the end I was able to get the info I wanted with a combination of different other helpful posts like:
PowerShell script to return members of multiple security groups
List user details from Username
Expanding on my original question and including the final result I wanted, this is how I did it. It's not beautiful (even repeats small portion of code) and big parts could probably be put in one line, but for my own readability alone it kinda makes sense this way. Also I omitted the discard of group, since I found the information useful.
Returning a table like this when formatted