Mailbox features

Enable Outlook Web App

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Enable Outlook Web App
$owaFeature = $mailboxParams.MailboxFeatures.Create("ADM_EXCHANGE_MAILBOXFEATURETYPE_OWA")
$owaFeature.Enabled = $true
$owaFeature.ParametersModificationsEnabled = $true

# Outlook Web App mailbox policy
$owaPolicyDN = 
    "CN=Default,CN=OWA Mailbox Policies," +
    "CN=First Organization,CN=Microsoft Exchange," +
    "CN=Services,CN=Configuration,DC=example,DC=com"

$owaPolicy = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$owaPolicy.ObjectDN = $owaPolicyDN
$owaFeature.Policy = $owaPolicy

# Add Outlook Web App feature to the collection of mailbox features 
$mailboxParams.MailboxFeatures.Add($owaFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Enable Exchange ActiveSync

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Enable Exchange ActiveSync
$activeSyncFeature = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_ACTIVESYNC")
$activeSyncFeature.Enabled = $true
$activeSyncFeature.ParametersModificationsEnabled = $true

# Exchange ActiveSync mailbox policy
$activeSyncPolicyDN = 
    "CN=Default,CN=Mobile Mailbox Policies," +
    "CN=First Organization,CN=Microsoft Exchange," +
    "CN=Services,CN=Configuration,DC=example,DC=com"

$activeSyncPolicy = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$activeSyncPolicy.ObjectDN = $activeSyncPolicyDN
$activeSyncFeature.Policy = $activeSyncPolicy

# Add ActiveSync feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($activeSyncFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Modify Unified Messaging parameters

The following code sample enables Unified Messaging for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Parameters used to enable the Unified Messaging feature
$enableUMMailboxParams = 
    New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeEnableUMMailboxParams"

# Set UM mailbox policy
$umMailboxPolicyDN =
    "CN=Default Policy,CN=UM Mailbox Policies," +
    "CN=First Organization,CN=Microsoft Exchange," +
    "CN=Services,CN=Configuration,DC=example,DC=com"


$umMailboxPolicy = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$umMailboxPolicy.ObjectDN = $umMailboxPolicyDN

$enableUMMailboxParams.Policy = $umMailboxPolicy

# UM Pin
$enableUMMailboxParams.Pin = "5674321"

# Force user to change the Pin at first logon
$enableUMMailboxParams.PinExpired = $true

# Extension generated automatically
$enableUMMailboxParams.ExtensionAutoGenerationEnabled = $true

# UM Extension
$enableUMMailboxParams.Extension = "51234"

# Enable Unified Messaging
$unifiedMessaging = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_UNIFIEDMESSAGING")
$unifiedMessaging.Enabled = $true
$unifiedMessaging.EnableParameters = $enableUMMailboxParams

# Add UM feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($unifiedMessaging)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

The following code sample resets PIN* for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Unified Messaging feature
$unifiedMessaging = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_UNIFIEDMESSAGING")
$unifiedMessaging.ParametersModificationsEnabled = $true

# Enable reset PIN
$unifiedMessaging.PinResetEnabled = $true

# Reset PIN parameters
$resetPinParams = $unifiedMessaging.PinResetParameters
$resetPinParams.GeneratePinAutomatically = $true
$resetPinParams.PinExpired = $false

$unifiedMessaging.PinResetParameters = $resetPinParams
$mailboxParams.MailboxFeatures.Add($unifiedMessaging)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

The following code sample changes Personal Operator Extension for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Unified Messaging feature
$unifiedMessaging = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_UNIFIEDMESSAGING")
$unifiedMessaging.ParametersModificationsEnabled = $true

# Persanal operator extension
$unifiedMessaging.OperatorNumber = "789"
$mailboxParams.MailboxFeatures.Add($unifiedMessaging)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

The following code sample adds a Unified Messaging mailbox extension for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Unified Messaging feature
$unifiedMessaging = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_UNIFIEDMESSAGING")
$unifiedMessaging.ParametersModificationsEnabled = $true

# Unified Messaging mailbox extensions
$umProxyAddresses = $unifiedMessaging.Extensions
$umProxyAddresses.OverrideOldValues = $false

$uMProxyAddress = $uMProxyAddresses.CreateAddress()
$uMProxyAddress.SetAddressParts("54448", "MyUMDialPlan.example.com")
$umProxyAddresses.Add("ADS_PROPERTY_APPEND", $uMProxyAddress)

$unifiedMessaging.Extensions = $umProxyAddresses
$mailboxParams.MailboxFeatures.Add($unifiedMessaging)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

The following code sample modifies other Unified Messaging parameters for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Unified Messaging feature
$unifiedMessaging = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_UNIFIEDMESSAGING")
$unifiedMessaging.ParametersModificationsEnabled = $true

# Enable for Automatic Speech Recognition
$unifiedMessaging.AutomaticSpeechRecognitionEnabled = $true

# Disallow UM calls from non-users
$unifiedMessaging.AllowUMCallsFromNonUsersFlag = "ADM_EXCHANGE_ALLOWUMCALLSFROMNONUSERSFLAG_NONE"

# Disallow the users to receive faxes
$unifiedMessaging.FaxEnabled = $false

# Allow anonymous callers to leave messages
$unifiedMessaging.AnonymousCallersCanLeaveMessages = $true

# Disallow users to configure call answering rules
$unifiedMessaging.CallAnsweringRulesEnabled = $false

# Add UM feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($unifiedMessaging)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Enable POP3

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Enable POP3
$pop3Feature = $mailboxParams.MailboxFeatures.Create("ADM_EXCHANGE_MAILBOXFEATURETYPE_POP3")
$pop3Feature.Enabled = $true
$pop3Feature.ParametersModificationsEnabled = $true

# Change MIME format of messages that are retrieved from the server : use HTML
$pop3Feature.UseProtocolDefault = $false
$pop3Feature.MessagesRetrievalMimeFormat = "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_HTML"

# Add POP3 feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($pop3Feature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Enable IMAP

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Enable IMAP
$imapFeature = $mailboxParams.MailboxFeatures.Create("ADM_EXCHANGE_MAILBOXFEATURETYPE_IMAP")
$imapFeature.Enabled = $true
$imapFeature.ParametersModificationsEnabled = $true

# Change MIME format of messages that are retrieved from the server: use plain text
$imapFeature.UseProtocolDefault = $false
$imapFeature.MessagesRetrievalMimeFormat = "ADM_EXCHANGE_MESSAGESRETRIEVALTYPE_TEXT"

# Add IMAP feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($imapFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Enable MAPI

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Get properties of the MAPI feature
$mapiFeature = $mailboxParams.MailboxFeatures.Create("ADM_EXCHANGE_MAILBOXFEATURETYPE_MAPI")

# Enabled MAPI feature
$mapiFeature.Enabled = $true

# Add MAPI feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($mapiFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Enable Archiving

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Parameters used to enable the Archiving feature
$archivingFeatureEnableParams = 
    New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeEnableArchiveMailboxParams"

$archiveDatabaseDN = 
    "CN=Archive Database,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT)," +
    "CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange," +
    "CN=Services,CN=Configuration,DC=Example,DC=com"

$archiveDatabase = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$archiveDatabase.ObjectDN = $archiveDatabaseDN

$archivingFeatureEnableParams.Database = $archiveDatabase

# Enable archiving
$archivingFeature = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_ARCHIVE")
$archivingFeature.Enabled = $true
$archivingFeature.EnableParameters = $archivingFeatureEnableParams

# Add Archiving feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($archivingFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

This code snippet illustrates how to modify the parameters of the Archiving feature.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

$archivingFeature = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_ARCHIVE")
$archivingFeature.ParametersModificationsEnabled = $true

# Archive name
$archivingFeature.ArchiveName = "%name% archive"

# Archive quota
$archiveQuota = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmByteQuantifiedSize"
$archiveQuota.SetMBytes(100)

$archivingFeature.ArchiveQuota = $archiveQuota

# Archive warning quota
$archiveWarningQuota = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmByteQuantifiedSize"
$archiveWarningQuota.SetMBytes(100)

$archivingFeature.ArchiveWarningQuota = $archiveWarningQuota

# Add Archiving feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($archivingFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_RESOLVEVALUEREFERENCES")

Retention Hold

The following code sample enables the Retention Hold* feature for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Parameters used to enable the Retention Hold feature
$retentionHoldEnableParams = 
    New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeEnableRetentionHoldParams"
$retentionHoldEnableParams.StartDate = Get-Date
$retentionHoldEnableParams.EndDate = (Get-Date).AddDays(7)

# Enable Retention Hold
$retentionHoldFeature = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_RETENTIONHOLD")
$retentionHoldFeature.Enabled = $true
$retentionHoldFeature.EnableParameters = $retentionHoldEnableParams

# Add Retention Hold feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($retentionHoldFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

The following code sample modifies parameters of the Retention Hold feature for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

$retentionHoldFeature = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_RETENTIONHOLD")
$retentionHoldFeature.ParametersModificationsEnabled = $true

# Change end date parameter
$retentionHoldFeature.EndDate = (Get-Date).AddDays(30)

# Add 'Retention Hold' feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($retentionHoldFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Litigation Hold

The following code sample enables the Litigation Hold feature for a mailbox.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Parameters used to enable the 'Litigation Hold' feature
$litigationHoldEnableParams = 
    New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeEnableLitigationHoldParams"
$litigationHoldEnableParams.Comment = "This mailbox is curently under Litigation Hold."
$litigationHoldEnableParams.Url = "http://www.example.com/LitigationHold"

$litigationHoldFeature = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_LITIGATIONHOLD")
$litigationHoldFeature.Enabled = $true
$litigationHoldFeature.EnableParameters = $litigationHoldEnableParams

# Add 'Litigation Hold' feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($litigationHoldFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

The following code sample modifies parameters of the Litigation Hold feature.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=example,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

$litigationHoldFeature = $mailboxParams.MailboxFeatures.Create(
    "ADM_EXCHANGE_MAILBOXFEATURETYPE_LITIGATIONHOLD")
$litigationHoldFeature.ParametersModificationsEnabled = $true

# Change the note
$litigationHoldFeature.Comment = "Your mailbox has been placed on litigation hold."

# Add 'Litigation Hold' feature to the collection of mailbox features
$mailboxParams.MailboxFeatures.Add($litigationHoldFeature)

# Save changes
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

See also