Forum Discussion

JoSoFine's avatar
JoSoFine
Copper Contributor
Sep 08, 2017
Solved

Exchange Management Shell: Getting title in Get-Mailbox for all results

I am trying to get a list of mailboxes that have been hidden from the GAL. The results have the contain there name, a true or false for HiddenFromAddressListsEnabled and there (job)title. The probl...
  • I think you are using old version of powershell (2.0) so that you got in-correct result and "name" is also  unique value 

    Here I have modified the script and this script will work for all the powershell version.

    $users = Get-Mailbox -ResultSize 10 | Select Name,HiddenFromAddressListsEnabled
    $users | Foreach-Object{
    
    $userinfo=Get-user $_.name |select Title
    New-Object -TypeName PSObject -Property @{
          Name = $_.Name
          HiddenFromAddressListsEnabled =$_.HiddenFromAddressListsEnabled
          Title= $userinfo.Title
               
          }
    
    } |select Name,HiddenFromAddressListsEnabled,Title