Script Repository


Check whether a certain mailbox feature is enabled

February 26, 2021
1782

The scripts are used to check whether a certain mailbox feature is enabled. If the featue is disabled, the scripts return false. To execute the scripts, use the If PowerShell script returns true condition.

Litigation Hold feature

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

Archive feature

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

Comments ( 0 )
No results found.
Leave a comment