$report = @()
$Mbxs = Get-Mailbox -Resultsize Unlimited
foreach ($Mbx in $Mbxs)
{
   $Owner = Get-Mailbox $Mbx | Get-MailboxPermission -Owner
   $Manager = Get-ADUser $mbx.SamAccountName -Server domain.com -Properties Manager #| select Name, @{N='Manager';E={(Get-ADUser $_.Manager).name}}
   $permission = get-mailboxpermission -identity $Mbx |where {$_.user -notlike "*NT AUTHORITY\SELF" -and $_.IsInherited -eq $false}| select  @{Name="Displayname"; Expression={(Get-Recipient $_.user.ToString()).Displayname.ToString()}}, @{Name="primarysmtpaddress"; Expression={(Get-Recipient $_.user.ToString()).primarysmtpaddress.ToString()}}, user, @{Name="AccessRights";Expression={$_.AccessRights}}| Select User, name, accessrights


    $reportObj = New-Object PSObject
    $reportObj | Add-Member NoteProperty -Name "Mailbox Name" -Value $mbx.name
    $reportObj | Add-Member NoteProperty -Name "RecipientTypeDetails" -Value $mbx.RecipientTypeDetails
    $reportObj | Add-Member NoteProperty -Name "Access Rights" -Value $permission.AccessRights
    $reportObj | Add-Member NoteProperty -Name "Username" -Value $permission.user
    $reportObj | Add-Member NoteProperty -Name "Owner" -Value $Owner.owner
    $reportObj | Add-Member NoteProperty -Name "Manager" -Value $Manager.manager


    
    $report += $reportObj

}
$report