Hi All,
Can anyone here please assist me in correcting the below script to shows the mailbox size ?
$xDays = 365
Get-Mailbox -ResultSize 50 -RecipientTypeDetails UserMailbox | Foreach-Object {
$si = Get-MailboxFolderStatistics $_ -IncludeOldestAndNewestItems -FolderScope SentItems
if($si.NewestItemReceivedDate -AND (New-TimeSpan $si.NewestItemReceivedDate.ToLocalTime()).Days -ge $xDays) {
#$_
New-Object PSObject -Property @{
Name = $_.Name
Alias = $_.Alias
PrimarySmtpAddress = $_.PrimarySmtpAddress
WhenCreated = $_.WhenCreated
Database = $_.Database
LastSentItemDate = $si.NewestItemReceivedDate
LastLogonTime = $si.LastLogonTime
MailboxSize = $si.TotalItemSize.Value
}
}
} | Select Name, Alias, PrimarySmtpAddress, LastSentItemDate, WhenCreated, LastLogonTime, Database, MailboxSize | Sort LastSentItemDate | Export-Csv -Path C:\temp\365Days.csv -NoTypeInformation -UseCulture