exchange 2013 mailbox folder size report

hello

i have exchange 2013 DAG

i need a script to get a report for every mailbox user with this information:

-  actual mailbox quota (issue warning,deny receive,deny receive and send)

-  the actual size of this folder on every mailbox:  
                inbox folder,
               deleted item folder,
               calendar  
               and a specific folder named "TEST".

-  the last user connexion "lastLogonTimestamp"

if possible i need the export to be generated on excel file and sended by email if possible

thank you for help
cawasakiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cawasakiAuthor Commented:
any script help plz?
0
dan_blagutCommented:
Hello
Using this hint http://exchangeserverpro.com/reporting-mailbox-folder-sizes-with-powershell/  I try to make a script for you

$mailboxes = @(Get-Mailbox -ResultSize Unlimited)
$report = @()

foreach ($mailbox in $mailboxes)
{
    $inboxstats = Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
    $calendarstats = Get-MailboxFolderStatistics $mailbox -FolderScope Calendar | Where {$_.FolderPath -eq "/Calendar"}
   $deletedstats = Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Deleted Items"}
    $teststats = Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Test"}
    $lastlogstats = Get-MailboxFolderStatistics $mailbox| select lastlogontime
      
      
    $mbObj = New-Object PSObject
    $mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
    $mbObj | Add-Member -MemberType NoteProperty -Name "Warning Quota" -Value $mailbox.IssueWarningQuota
      $mbObj | Add-Member -MemberType NoteProperty -Name "Deny Send Quota" -Value $mailbox.ProhibitSendQuota
      $mbObj | Add-Member -MemberType NoteProperty -Name "Deny Send and Receive Quota" -Value $mailbox.ProhibitSendReceiveQuota
      $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFolderSize.ToMB()
    $mbObj | Add-Member -MemberType NoteProperty -Name "Calendar Size" -Value $calednstats.FolderandSubfoldersSize.ToMB()
   $mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items Size (Mb)" -Value $deletedstats.FolderandSubFolderSize.ToMB()
  $mbObj | Add-Member -MemberType NoteProperty -Name "Test Size (Mb)" -Value $teststats.FolderandSubFolderSize.ToMB()
  $mbObj | Add-Member -MemberType NoteProperty -Name "Last Logon" -Value $lastlogstats       

      $report += $mbObj
}

$report| Export-CSV ./mailboxesstat.csv

Dan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cawasakiAuthor Commented:
HELLO

THANK you i will test it :)
0
cawasakiAuthor Commented:
hello,

i have only get the quota for user on csv and this is the error:

You cannot call a method on a null-valued expression.
At C:\sources\script\mailboxreport\report.ps1:18 char:7
+       $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Valu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\sources\script\mailboxreport\report.ps1:19 char:5
+     $mbObj | Add-Member -MemberType NoteProperty -Name "Calendar Size" -Value $c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\sources\script\mailboxreport\report.ps1:20 char:4
+    $mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items Size (Mb)"  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\sources\script\mailboxreport\report.ps1:21 char:3
+   $mbObj | Add-Member -MemberType NoteProperty -Name "Test Size (Mb)" -Value $te ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Open in new window

0
cawasakiAuthor Commented:
any help plz?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.