Passing variable from $_.SamAccountName to piped command
<p>Could anyone tell me how to get the username, Identity Reference and Access Control Type listed like the example below?</p>

<pre>Username         IdentityRefrerance        AccessControlType
fred             BuiltIn\Account Operator  Allow</pre>

<p>I have created the below PS script but i cant get the username passed over.</p>

<pre><code>Import-Module ActiveDirectory
Set-Location AD:
$Users = Get-ADUser -Filter * | % {$_.SamAccountName}

foreach ($User in $Users) {
    (Get-Acl (Get-ADUser -Identity $User).DistinguishedName).Access | 
    Where-Object {$_.IdentityReference -eq "BUILTIN\Account Operators"} return true |
    select IdentityReference, AccessControlType
}
</code></pre>