I found a script that works for everything but the inbox. Can someone assist as I need total items and size for the inbox. Here is what I found
$erroractionpreference = "SilentlyContinue"
$warningactionpreference = "SilentlyContinue"
#View the Entire Forest
Set-ADServerSettings -ViewEntireForest:$True
[Array] $MailboxVariablesCollection = @()
# Hit all Mailboxes
(Get-Mailbox -ResultSize Unlimited) | ForEach {
$erroractionpreference = "SilentlyContinue"
$warningactionpreference = "SilentlyContinue"
# Get the DisplayName, LastLogonTime, DatabaseName and TotalItemSize statistics
$MailboxStats = Get-MailboxStatistics $_.identity | Select DisplayName, LastLogonTime, DatabaseName, TotalItemSize
# Enumerate Inbox, Sent, Junk-Email and Deleted Items
$mbInboxStats = Get-MailboxFolderStatistics $_.identity | Where {$_.FolderPath -eq "/Inbox Items"} | Select ItemsInFolderAndSubfolders, @{name="InboxItemsSize";expression={$_.FolderAndSubfolderSize.ToMB()}}
$mbSentStats = Get-MailboxFolderStatistics $_.identity | Where {$_.FolderPath -eq "/Sent Items"} | Select ItemsInFolderAndSubfolders, @{name="SentItemsSize";expression={$_.FolderAndSubfolderSize.ToMB()}}
$mbDeletedStats = Get-MailboxFolderStatistics $_.identity | Where {$_.FolderPath -eq "/Deleted Items"} | Select ItemsInFolderAndSubfolders, @{name="DeletedItemsSize";expression={$_.FolderAndSubfolderSize.ToMB()}}
#$mbJunkEmailStats = Get-MailboxFolderStatistics $_.identity –FolderScope JunkEmail | Select ItemsInFolderAndSubfolders,@{name="JunkEmailItemCount";expression={$_.FolderAndSubfolderSize.ToMB()}}
$mbJunkEmailStats = Get-MailboxFolderStatistics $_.identity | Where {$_.FolderPath -eq "/Junk E-mail"} | Select ItemsInFolderAndSubfolders,@{name="JunkEmailItemCount";expression={$_.FolderAndSubfolderSize.ToMB()}}
$mbManagedFolderStats = Get-MailboxFolderStatistics $_.identity | Where {$_.FolderPath -eq "/Managed Folders"} | Select ItemsInFolderAndSubfolders,@{name="ManagedFolderItemCount";expression={$_.FolderAndSubfolderSize.ToMB()}}
$MailboxVariables = "" | Select "Display Name", "Last Logon Time", Database, "Mailbox Size (MB)", "Total Inbox Items", "Inbox Items Size (MB)", "Total Sent Items","Sent Items Size (MB)", "Total Deleted Items", "Deleted Items Size (MB)", "JunkEmailItemCount", "TotalJunkEmailSizeMB","ManagedFolderItemCount","ManagedFolderEmailSizeMB","E-mail Address"
$MailboxVariables."Display Name" = $MailboxStats.DisplayName
$MailboxVariables."Last Logon Time" = $MailboxStats.LastLogonTime
$MailboxVariables.Database = $MailboxStats.DatabaseName
$MailboxVariables."Mailbox Size (MB)" = "{0:n2}" -f ($MailboxStats.TotalItemSize.Value.ToMB())
$MailboxVariables."Total Inbox Items" = "{0:n1}" -f ($mbInboxStats.ItemsInFolderAndSubfolders)
$MailboxVariables."Inbox Items Size (MB)" = "{0:n2}" -f ($mbInboxStats.InboxItemsSize)
$MailboxVariables."Total Sent Items" = "{0:n1}" -f ($mbSentStats.ItemsInFolderAndSubfolders)
$MailboxVariables."Sent Items Size (MB)" = "{0:n2}" -f ($mbSentStats.SentItemsSize)
$MailboxVariables."Total Deleted Items" = "{0:n1}" -f ($mbDeletedStats.ItemsInFolderAndSubfolders)
$MailboxVariables."Deleted Items Size (MB)" = "{0:n2}" -f ($mbDeletedStats.DeletedItemsSize)
$MailboxVariables."TotalJunkEmailSizeMB" = "{0:n2}" -f ($mbJunkEmailStats.JunkEmailItemCount)
$MailboxVariables."JunkEmailItemCount" = "{0:n1}" -f ($mbJunkEmailStats.ItemsInFolderAndSubfolders)
$MailboxVariables."ManagedFolderEmailSizeMB" = "{0:n2}" -f ($mbManagedFolderStats.ManagedFolderItemCount)
$MailboxVariables."ManagedFolderItemCount" = "{0:n1}" -f ($mbManagedFolderStats.ItemsInFolderAndSubfolders)
$MailboxVariables."E-mail Address" = $_.PrimarySmtpAddress
$MailboxVariablesCollection += $MailboxVariables
}
`
-Subject "Exchange 2010 Mailbox Junk Email and Deleted Items Folders - $Date" -SmtpServer "ex-cas1.vlab.com" -BodyAsHtml -Attachments C:Scripts"MailboxStats_All_Mailboxes_$(Get-Date -f 'yyyyMMdd').csv"
Invoke-Expression C:Scripts"MailboxStats_All_Mailboxes_$(Get-Date -f 'yyyyMMdd').csv"