Commands › Exchange Online

New-OutlookProtectionRule

Exchange Online ExchangeOnlineManagement New-*

**Note**: This cmdlet is no longer supported in the cloud-based service. Use the New-OutlookProtectionRule cmdlet to create a Microsoft Outlook protection rule.

Quick start script

# New-OutlookProtectionRule — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-OutlookProtectionRule
$before | Format-List

# 3. Make the change (dry run first)
New-OutlookProtectionRule -Name <String> -ApplyRightsProtectionTemplate <RmsTemplateIdParameter> -WhatIf
New-OutlookProtectionRule -Name <String> -ApplyRightsProtectionTemplate <RmsTemplateIdParameter>

# 4. Verify and diff
$after = Get-OutlookProtectionRule
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

New-OutlookProtectionRule [-Name] <String> -ApplyRightsProtectionTemplate <RmsTemplateIdParameter>
 [-Confirm]
 [-DomainController <Fqdn>]
 [-Enabled <Boolean>]
 [-Force]
 [-FromDepartment <String[]>]
 [-Priority <Int32>]
 [-SentTo <RecipientIdParameter[]>]
 [-SentToScope <ToUserScope>]
 [-UserCanOverride <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (12)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifies a name for the rule.
-ApplyRightsProtectionTemplate RmsTemplateIdParameter yes The ApplyRightsProtectionTemplate parameter specifies the AD RMS template to apply to the message. An AD RMS template can be specified using the template name. Use the Get-RMSTemplate cmdlet to retrieve templates...
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-DomainController Fqdn This parameter is available only in on-premises Exchange.
-Enabled Boolean The Enabled parameter specifies whether the Outlook protection rules are enabled. New Outlook protection rules are enabled by default. To create a rule without enabling it, set the Enabled parameter to $false.
-Force SwitchParameter The Force switch hides warning or confirmation messages. You don't need to specify a value with this switch.
-FromDepartment String[] The FromDepartment parameter specifies the sender's department as a condition. The user's department property is compared with the value specified.
-Priority Int32 The Priority parameter specifies whether to set the order of processing of Outlook protection rules. Rules with a lower priority value are executed first.
-SentTo RecipientIdParameter[] The SentTo parameter specifies one or more recipients as a rule condition. You can use any value that uniquely identifies the internal recipient. For example:
-SentToScope ToUserScope The SentToScope parameter specifies the message scope as a condition. You can use one of the following values:
-UserCanOverride Boolean The UserCanOverride parameter specifies whether users can override actions taken by Outlook protection rules. By default, users can override actions taken by Outlook protection rules. When set to $false, the...
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.