How to add SAMAccounts to results?

Hi all,

Stuck on how to add SAMAccounts (AD usernames) to the results, can anyone help?

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITYSELF" -and $_.IsInherited -eq $false} | Select Identity,User,Username,@{Name='Access Rights';Expression= {[string]::join(', ', $_.AccessRights)}} | Export-Csv -NoTypeInformation C:tempmailboxpermissions1.csv 

submitted by /u/Moeafg
[link] [comments]

Leave a Reply