Script repository

Check whether a certain mailbox feature is enabled

Updated on: Jan 18, 2026, Views: 4181

Exchange

The scripts are used to check whether a certain mailbox feature is enabled. If the feature is disabled, the scripts return false. To execute the scripts, use the If PowerShell script returns true condition in a business rule, custom command or scheduled task.

Litigation Hold

try
{
    $mailboxParams = $Context.TargetObject.GetMailParameters()
}
catch
{
    return
}
$litigationHold = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_LITIGATIONHOLD")
    
$Context.ConditionIsMet = $litigationHold.Enabled

Archiving

try
{
    $mailboxParams = $Context.TargetObject.GetMailParameters()
}
catch
{
    return
}
$archive = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_ARCHIVE")
    
$Context.ConditionIsMet = $archive.Enabled

Comments 2

You must be signed in to comment.

  • Grant

    Grant

    Does this check the Litigation Hold status in Exchange Online if the user is a remote mailbox (hybrid environment)? If not can you share how I would change this for an Exchange Online mailbox.

    • Support

      Support

      Hello Grant,

      The script works just fine for remote mailboxes.

Got questions?

Support Questions & Answers

We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.