Use the -IncludeSoftDeletedRecipients switch:
Get-MailboxStatistics InactiveMailbox -IncludeSoftDeletedRecipients
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm trying to retrieve mailbox statistics for a mailbox that I put on litigation hold, then deleted its associated account in office 365. I know the mailbox is inactive state.
Is it possible to query mailbox statistics for mailbox that has been put on litigation hold then the associated user account deleted in office 365, I need to achieve this using powershell.
My PowerShell script and the error that is getting.
PS C:\Windows\system32> $inactive = Get-Mailbox -InactiveMailboxOnly
PS C:\Windows\system32> $user = $inactive.SamAccountName
PS C:\Windows\system32> $mailstat = Get-MailboxStatistics $user
The specified mailbox Identity:"$VLHCB0-O2T8NUTCI12G" doesn't exist.
+ CategoryInfo : NotSpecified: (:) [Get-MailboxStatistics], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : [Server=AM9PR09MB4882,RequestId=97a79e6b-77a1-48f8-9a1a-32ada94a0f5a,TimeStamp=4/14/2022 6:49:24 PM] [FailureCategory=Cmdlet-ManagementObjectNotFoundExceptio
n] FE6CA880,Microsoft.Exchange.Management.MapiTasks.GetMailboxStatistics
+ PSComputerName : outlook.office365.com
I get the same errors above, when i pass each accepted identity parameter value for get-mailboxstatistics cmdlet
According to microsoft, this are the accepted values for identity parameter, when using get-mailboxstatistics:
Name
Alias
Distinguished name (DN)
Canonical DN
Domain\Username
Email address
GUID
LegacyExchangeDN
SamAccountName
User ID or user principal name (UPN)
Use the -IncludeSoftDeletedRecipients switch:
Get-MailboxStatistics InactiveMailbox -IncludeSoftDeletedRecipients