Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Please assist me in modifying PowerShell script to display the MailboxSize ?

$
0
0

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

So far the result column are all populated except the MailboxSize column.
Thanks in advance

Viewing all articles
Browse latest Browse all 6937

Trending Articles