How to add full username to a list returned by get-acl?

2

I want to prepare a list of persons having access to a given folder. The list should also contain the level of access granted. I figured out the following powershell command:

Get-Acl \\path\to\my\folder | Select-Object path -ExpandProperty Access | ft IdentityReference, FileSystemRights

This is almost what I need. I want to replace IdentityReference column with a column containing full user names. I am trying to achieve it by passing IdentityReference value to Get-QADUser cmdlet, but I do not know how to format the output to see both the full user name and FileSystemRights column.

MBu

Posted 2012-09-04T12:04:04.700

Reputation: 1 216

Answers

1

try this, but untested

Get-Acl  | 
   Select-Object path -ExpandProperty Access | 
      select IdentityReference, FileSystemRights | 
         Select @{n='identity';e={$_.IdentityReference}},* | Get-QADUser

walid2mi

Posted 2012-09-04T12:04:04.700

Reputation: 126

Thank you. I managed to run your code with minor modifications: I had to add .Value after $_.IdentityReference. But it still does not give the output I want. How to combine FileSystemRights returned by Get-Acl with Name property returned by Get-QADUser into a single table? – MBu – 2012-09-04T15:49:02.570

After some experiments I managed to achieve the desired result: Get-Acl \\my\folder | Select-Object path -ExpandProperty Access | select @{n='User';e={ (Get-QADUser -Identity $_.IdentityReference.Value).Name }},FileSystemRights. I am accepting your answer as it pushed me in right direction :-) – MBu – 2012-09-04T16:22:11.127

For those who do not want to install Active Directory Module form quest I modified the solution to work with built-in AD cmdlets: Get-Acl \\my\folder | Select-Object Path -ExpandProperty Access | Select-Object @{n='User';e={ (Get-ADUser -Identity $_.IdentityReference.Value.Split("\")[1]).Name }},FileSystemRights – MBu – 2013-06-03T07:36:19.053