blog.brian nuszkowski.com - A blip in IT.
Storage Limit Status (StorageLimitStatus) on Exchange Public Folders

As an Exchange administrator, it’s helpful to have a relatively effortless way to determine if a user’s mailbox is approaching its limit in terms of disk storage space. We achieve this by using the Get-MailboxStatistics commandlet and look at the value returned in the StorageLimitStatus property. Think of StorageLimitStatus as a fuel gauge for mailbox disk space utilization and is relative to the quotas being applied, whether at the database or mailbox level.

If you’re unlucky lucky enough to still be supporting Public Folders, you probably don’t(care) to know that there is a similar statistics generating commandlet for public folders: Get-PublicFolderStatistics. Alright, now that you know that - time to go home for the day. Wait..what? At first glance, it looks pretty similar. It spits out some unique identifiers, TotalDeletedItemSize, TotalItemSize, etc. What’s missing? StorageLimitStatus.

What is similar about mailboxes and public folders are that they generate a storage status message during your nightly database maintenance schedule that is delivered to the mailbox/PF. That’s great for your individual user mailbox, but not for your 27 person HR department that utilizes that public folder. Guess what? Bob from HR gets to work about 30 minutes before everyone else and takes pride in being the first employee to read(or not) and delete the warning message. What Bob didn’t tell anyone was that the HR Public Folder is 1MB from being full. When you go to add a message to it later that afternoon, Outlook gets you with a cryptic error dialog that has nothing to do with storage space or quotas (Something along the line of Cannot move items). It’s 4:02PM, so naturally Bob has left for the day. This issue escalates its way through your IT organization and eventually to your Exchange administrator (you). Instead of spending a bunch of time fumbling through the Exchange Management Console remembering where in the hell the Public Folder Management Console is hidden, I suggest using the Exchange Management Shell. Below is a PowerShell that script uses Get-PublicFolderStatistics but in addition, goes through the trouble of determining the Public Folder database limits as well as the overridden limits (if any) on the folder and then determines a storage limit status based upon the folder’s TotalItemSize property. The syntax is:

GetPublicFolderStatistics_v2.ps1 -folderpath “\WhateverPF” | select FolderPath, StorageLimitStatus

param([string] $folderpath)

$pf_db = Get-PublicFolderDatabase -status
$pf_db_post_quota = $pf_db.ProhibitPostQuota
$pf_db_warn_quota = $pf_db.IssueWarningQuota

$pf_sizes = Get-PublicFolderStatistics -Identity $folderpath -results:unlimited

$pf_sizes | ForEach-Object {

$item = $_
$current_size = $_.TotalItemSize
$get_pf = Get-PublicFolder -Identity $_.Identity

if ($get_pf.UseDatabaseQuotaDefaults -eq $True) {
    $current_post = $pf_db_post_quota
    $current_warn = $pf_db_warn_quota
} else {
    $current_post = $get_pf.ProhibitPostQuota
    $current_warn = $get_pf.IssueWarningQuota
}

if ($_.TotalItemSize.Value.ToBytes() -lt $current_post.Value.ToBytes())
{
    $storagelimitstatus = “BelowLimit”
}

if ($_.TotalItemSize.Value.ToBytes() -ge $current_warn.Value.ToBytes() -AND $_.TotalItemSize.Value.ToBytes() -lt $current_post.Value.ToBytes())
{
    $storagelimitstatus = “IssueWarning”
}

if ($_.TotalItemSize.Value.ToBytes() -ge $current_post.Value.ToBytes())
{
    $storagelimitstatus = “ProhibitPost”
}

    $item | add-member -MemberType NoteProperty -Name “QuotaWarn” -Value $current_warn
    $item | add-member -MemberType NoteProperty -Name “QuotaPost” -Value $current_post
    $item | add-member -MemberType NoteProperty -Name “StorageLimitStatus” -Value $storagelimitstatus
    $item | select *
}