Get-Mailboxpermission with AD Account Displayname
Greetings, In out AD environment, accounts are numbers. When I list mailbox permissions, it is difficult to determine who the user actually is. The output looks like this User AccessRights ---- ------------ Domain\131735 {FullAccess} I am trying to get the domain displayname, but I have not been successful. Here is the code I have so far: Get-MailboxPermission $args[0]|Where {$_.isInherited -eq $false -and ($_.user -notmatch "S-1-5-21")-and($_.user -notmatch "AUTHORITY")-and($_.user -notmatch "Organiz")} |select accessrights, user, @{label="Displayname"; expression={get-qaduser $_.user |select displayname}} I suspect get-qaduser does not like pipeline input? Thanks in Advance, I have spent a couple hours on this and I am stuck. Mike Hanlon
October 4th, 2011 11:06am

Try it this way: expression={get-qaduser $_.user |select -expand displayname} or: expression={(get-qaduser $_.user).displayname} [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
October 4th, 2011 11:12am

Thanks mjoliner, I am still not receiving a value for the displayname with either suggestion. I do not receive an error message either. This Get-MailboxPermission $args[0]|Where {$_.isInherited -eq $false -and ($_.user -notmatch "AUTHORITY")-and ($_.user -notmatch "S-1-5-21") }|select user, @{label="Displayname";expression={get-qaduser $_.user |select -expand displayname}}, accessrights Comes back with: User Displayname AccessRights ---- ----------- ------------ Domain\131735 {FullAccess}Mike Hanlon
October 4th, 2011 12:06pm

get-qaduser isn't liking the way the identity parameter is being passed. Try this: Get-MailboxPermission $args[0]|Where {$_.isInherited -eq $false -and ($_.user -notmatch "AUTHORITY")-and ($_.user -notmatch "S-1-5-21") }|select user, @{label="Displayname";expression={get-qaduser $_.user.tostring() |select -expand displayname}}, accessrights[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
October 4th, 2011 12:49pm

Sweet! Thanks a ton!Mike Hanlon
October 4th, 2011 12:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics