Script Repository

Check mailbox size

February 24, 2021

The script can be used in business rules, custom commands and scheduled tasks to check user mailbox size. It returns True if the mailbox size exceeds a certain limit. To use the script in your rule, command or task, add the If PowerShell script returns true condition.


  • $limitGigabytes - Specifies the mailbox size limit (in gigabytes).
Edit Remove
$limitGigabytes = 2 # TODO: modify me

# Get Exchange properties
$mailboxParams = $Context.TargetObject.GetMailParameters()

# Get mailbox size
$sizeInGBytes = $mailboxParams.UsageInfo.Size.GetGBytes()

$Context.ConditionIsMet = $sizeInGBytes -ge $limitGigabytes

Comments ( 0 )
No results found.
Leave a comment