top of page

Report Exchange Online mailbox status for all Entra users

  • romanvitsinskyi
  • 5 days ago
  • 1 min read

Exchange Online mailbox status and creation date

Ever had a need to report EXO mailbox status and its creation date for all of Entra users? Use below PowerShell query based on Get-MgUser and Get-Mailbox. If you need this report for subset of users, just replace filter used in $users variable.


$users = Get-MgUser -Property SignInActivity,DisplayName,UserPrincipalName,AccountEnabled,UserType,CompanyName,Department,JobTitle,CreatedDateTime,Identities,OnPremisesSyncEnabled,UserType -All | ? {$_.UserType -eq "Member"}
$report = @()
foreach ($user in $users)
    {
      $mailbox = Get-Mailbox -Identity $($user.UserPrincipalName) -ErrorAction silentlycontinue
      $report += $user | select DisplayName,CompanyName,AccountEnabled,UserPrincipalName,@{N="User Creation Date"; E={$_.CreatedDateTime.ToUniversalTime()}}, `
                                @{N="Mailbox exists"; E={if ($mailbox) {"Yes"} else {"No"}}}, `
                                @{N="Mailbox creation time"; E={$mailbox.WhenCreated.ToUniversalTime()}}
    }
    $report | Export-Csv c:\temp\mailbox_status.csv

 
 
bottom of page