none
Get Full name from Get-MailBoxPermission RRS feed

  • Question

  • I am trying to build a report with the names of users who have access to shared mailboxes. I have the command running and outputting good information, but it displays a table in the following format:

    User

    ----

    Domain\Username

    How can I get output that display's the user's Fullname, first and last? 

    Here is the code:

    $Users = Get-MailboxPermission -identity callcenter | where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false} | Select User

    $Users | Format-Table

    Thank you for any help

    Monday, May 12, 2014 7:24 PM

Answers

  • How about this?

    $users = Get-MailboxPermission -identity callcenter | where {$_.user -notlike "*NT AUTHORITY\SELF" -and $_.IsInherited -eq $false}

    $users | select @{Name="User Name";expression={(Get-Recipient $_.user.tostring()).displayname}} | FT

    OR

    $users | select @{Name="First Name";expression={(Get-Recipient $_.user.tostring()).FirstName}}, @{Name="Last Name";expression={(Get-Recipient $_.user.tostring()).LastName}}


    • Edited by Amit TankModerator Monday, May 12, 2014 8:07 PM added fn, ln
    • Marked as answer by JeeNz Monday, May 12, 2014 8:17 PM
    Monday, May 12, 2014 8:04 PM
    Moderator

All replies

  • How about this?

    $users = Get-MailboxPermission -identity callcenter | where {$_.user -notlike "*NT AUTHORITY\SELF" -and $_.IsInherited -eq $false}

    $users | select @{Name="User Name";expression={(Get-Recipient $_.user.tostring()).displayname}} | FT

    OR

    $users | select @{Name="First Name";expression={(Get-Recipient $_.user.tostring()).FirstName}}, @{Name="Last Name";expression={(Get-Recipient $_.user.tostring()).LastName}}


    • Edited by Amit TankModerator Monday, May 12, 2014 8:07 PM added fn, ln
    • Marked as answer by JeeNz Monday, May 12, 2014 8:17 PM
    Monday, May 12, 2014 8:04 PM
    Moderator
  • Perfect, that was exactly what I was looking for. I tried several sets of code I took from other examples and couldn't get the syntax quite right.

    Thank you for your help.

    Monday, May 12, 2014 8:17 PM
  • Simplier on the expression by using get-user

    $users = Get-MailboxPermission -identity callcenter| where {$_.user -notlike "*NT AUTHORITY\SELF" -and $_.IsInherited -eq $false}

    $users | select @{Name="User Name";expression={Get-user $_.user}} | FT



    • Edited by Ryan Chau Thursday, September 21, 2017 4:39 PM
    Thursday, September 21, 2017 4:38 PM