#Created By Alberto Igbinedion

########### Get Single User Quota #############
# Get-Mailbox -identity phi144 | Get-MailboxStatistics| Select StorageLimitStatus, TotalItemSize
# Get-mailbox -identity phi144 | select ProhibitSendQuota

########## Check where Prohibit or Warning issued #############
# Get-Mailbox  -Resultsize Unlimited | Get-MailboxStatistics  | where {($_.StorageLimitStatus -contains “ProhibitSend”) –or ($_.StorageLimitStatus -contains “IssueWarning”)} | Export-Csv C:\Scripts\Output\QuotaLimitsWarnings.csv  -NoTypeInformation

######## Check All Users Quota #########
$AllMailboxes = @()
$Mailboxes = Get-Mailbox -ResultSize Unlimited | Select DisplayName, Database, IssueWarningQuota, ProhibitSendQuota, ProhibitSendReceiveQuota, Alias
foreach ($Mailbox in $Mailboxes){
    $MailboxStats = "" |Select  DisplayName,Database,IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota,TotalItemSize,ItemCount,StorageLimitStatus
    $Stats = Get-MailboxStatistics -Identity $Mailbox.Alias
    $MailboxStats.DisplayName = $Mailbox.DisplayName 
    $MailboxStats.Database = $Mailbox.Database
    $MailboxStats.IssueWarningQuota = $Mailbox.IssueWarningQuota
    $MailboxStats.ProhibitSendQuota =$Mailbox.ProhibitSendQuota
    $MailboxStats.ProhibitSendReceiveQuota =$Mailbox.ProhibitSendReceiveQuota
    $MailboxStats.TotalItemSize = $Stats.TotalItemSize
    $MailboxStats.ItemCount = $Stats.ItemCount
    $MailboxStats.StorageLimitStatus = $Stats.StorageLimitStatus
    $AllMailboxes += $MailboxStats
}
$AllMailboxes | Export-Csv C:\Scripts\Output\QoutaLimits.csv  -NoTypeInformation
