Remove retention policy from mailbox powershell

Remove retention policy from mailbox powershell DEFAULT

I ran into a weird issue this week where I was trying to forcibly remove a deleted (inactive) mailbox, and was getting the following error:

“The user mailbox couldn’t be permanently deleted. The user mailbox has at least one type of hold or hold policy applied to it.”

The annoying thing about it was that this mailbox fell under a retention policy in the Security & Compliance Center – which are great, don’t get me wrong – but one of my biggest concerns with using these retention policies is that you can’t easily tell which mailboxes fall under this hold:

I found a few blog posts out there that mentioned different approaches of identifying these mailboxes with PowerShell, but none of them were working for me – all I was getting was that the policy applied to ‘All’. Not very useful at all!

I tried several approaches including trying to exclude the mailbox from the retention policy (didn’t work), applying litigation hold and removing it (no dice), and then I was going to attempt to restore the mailbox, remove it from the policy, and then delete it again – thankfully, I found a better way! There’s an -IgnoreLegalHold switch you can use, which will still allow you to delete the offending mailboxes:

Now, you’d think I was done, but not quite! Two of the four mailboxes hadn’t been properly deleted from the Deleted Users container in Azure AD, so Exchange would not allow me to delete the mailboxes:

Thankfully, this one is a bit easier – I’ve had to do this one quite often. Start out by searching for your deleted users – in this case I used a search string, because as you can sort of see from the screenshot below, I had two identical users in Azure AD – same Display name, same User Principal Name, and of course… Different Object Ids.

Now that I had my object Ids, I could safely go in and remove them – it’s always a good idea to use the Object Ids or Exchange GUIDs, because you know you’re targeting the object directly, and there’s no chance of an ambiguous name coming back and biting you in the butt. Measure twice and cut once!

After about 10 minutes or so, I was able to delete both of those mailboxes in Exchange Online:

Definitely a bit of a puzzler, but all sorted out now with another tool in my PowerShell toolbelt – hope this helps someone who is scratching their head trying to figure it out!

Like this:

LikeLoading...

Related

Sours: https://masterandcmdr.com/2020/04/24/cannot-delete-a-mailbox-with-retention-policies-enabled/

Manage Retention Policy and Tags by using PowerShell | Office 365 5/5 (3) 6 min read

In the current article, we will review how to use PowerShell commands for managing Retention Policy in Exchange Online environment.

The retention policy is a very powerful feature of Exchange Online but at the same time, unfamiliar to the most of us.
The Retention policy enables us to manage mail item’s Retention. In other words: Manage email before the email manage you!

The “Retention policy” is a collection of Retention Tags. Each Tag includes setting or “action” that will be applied to Mail item after a specific amount of time (measured in days). The “Action” could be:

  1. Delete Mail items
  2. Move Mail item to the Archive

Exchange Online includes built-in default Retention policy (Default MRM Policy) that is applied automatically for each Office 365 Mailboxes.

In this article, we review PowerShell commands that relate to the Retention Policy.
An additional issue is the Folder Assistant; this is the Exchange Online process that runs in the background and enforces or applies the Retention Policy on the Office 365 Mailboxes.

Article Table of content | Click to Expand

PowerShell | Help & additional information

Running PowerShell commands in Office 365 based environment
To be able to run the PowerShell commands specified in the current article, you will need to create a remote PowerShell with Azure Active Directory or Exchange Online. In case that you need help with the process of creating a Remote PowerShell session, you can use the links on the bottom of the Article.

1. Manage Retention Policy | Apply Retention Policy

1.1 – Apply Retention policy for a single Mailbox

PowerShell command syntax

1

Set-Mailbox<mailbox>–RetentionPolicy<Policy name>

PowerShell command Example

1

1.2 – Apply Retention Policy to ALL Office 365 Mailbox’s (Bulk Mode)

PowerShell command syntax

1

$UserMailboxes=Get-Mailbox-Filter{(RecipientTypeDetails-eq'UserMailbox')}$UserMailboxes|Set-Mailbox–RetentionPolicy<Policy name>

PowerShell command Example

1

$UserMailboxes=Get-Mailbox-Filter{(RecipientTypeDetails-eq'UserMailbox')}$UserMailboxes|Set-Mailbox–RetentionPolicy"My Policy

2. Manage Retention Policy | Remove Retention Policy

2.1 – Remove Retention Policy from a single a Mailbox (set to Null)

PowerShell command syntax

1

Set-Mailbox<Mailbox>  -RetentionPolicy$Null

PowerShell command Example

2.2 – Remove Retention Policy for a Mailbox Retention policy to ALL Office 365 Mailbox’s (Bulk Mode)

PowerShell command Example

1

$UserMailboxes=Get-Mailbox-Filter{(RecipientTypeDetails-eq'UserMailbox')}$UserMailboxes|Set-Mailbox–RetentionPolicy$Null

3. Manage Retention Policy | Display information about Retention Policy

3.1 – Display the Retention Policy applied to a User Mailbox

PowerShell command syntax

1

Get-Mailbox<Mailbox>  |FLRetentionPolicy

PowerShell command Example

1

[email protected]o.com|FLRetentionPolicy

3.2 – Display the Retention Policy applied to all Office 365 users Mailbox’s

PowerShell command Example

1

Get-Mailbox-ResultSizeUnlimited|where{$_.name-Notlike'*DiscoverySearchMailbox*'}|selectAlias,RetentionPolicy

4. Retention Policy Tags | Manage Default Retention Policy Tags settings

4.1 – Set the number of days for Deleted items, Tag

PowerShell command syntax

1

Set-RetentionPolicyTag"Deleted Items"–AgeLimitForRetention<Number of days>

PowerShell command Example

1

Set-RetentionPolicyTag"Deleted Items"-AgeLimitForRetention100

4.2 – Disable Deleted items Tag

PowerShell command Example

1

Set-RetentionPolicyTag"Deleted Items"-RetentionEnabled$False

4.3 – Set the number of days for Junk Email Tag

PowerShell command syntax

1

Set-RetentionPolicyTag"Junk Email"-AgeLimitForRetention<Number of days>

PowerShell command Example

1

Set-RetentionPolicyTag"Junk Email"-AgeLimitForRetention100

5. Retention Policy Tags | Create NEW Retention Policy Tags

5.1 – Create NEW tag for Sync Issues Folder

PowerShell command syntax

1

New-RetentionPolicyTag-Name<Tag name>-Type'SyncIssues'-AgeLimitForRetention<number of days>-RetentionAction'DeleteAndAllowRecovery'-RetentionEnabled$True

PowerShell command Example

1

New-RetentionPolicyTag-Name"My Tag"-Type'SyncIssues'-AgeLimitForRetention120-RetentionAction'DeleteAndAllowRecovery'-RetentionEnabled$True

6. Activate Folder Assistant

6.1 – Run the Managed Folder Assistant for a specific Mailbox

PowerShell command syntax

1

Start-ManagedFolderAssistant<Mailbox>

PowerShell command Example

6.2 – Run the Managed Folder Assistant for all Office 365 Mailbox’s (Bulk Mode)

PowerShell command Example

1

$UserMailboxes=Get-Mailbox-Filter{(RecipientTypeDetails-eq'UserMailbox')}$UserMailboxes|ForEach{Start-ManagedFolderAssistant$_.Identity}

7. Manage Deleted items policy tag

7.1 – Set Deleted items policy for 30 days for specific user

PowerShell command syntax

1

Get-Mailbox  |Set-Mailbox-SingleItemRecoveryEnabled$True-RetainDeletedItemsFor<Number of Days>

PowerShell command Example

1

Get-MailboxJohn|Set-Mailbox-SingleItemRecoveryEnabled$True-RetainDeletedItemsFor30

7.2 – Set Deleted items policy for 30 days for ALL user (Bulk)

PowerShell command Example

1

Get-Mailbox-ResultSizeUnlimited|Set-Mailbox-SingleItemRecoveryEnabled$True-RetainDeletedItemsFor30

7.3 – Display information about Deleted items policy for specific user

PowerShell command syntax

1

Get-Mailbox<Mailbox>   |FLAlias,RetainDeletedItemsFor

PowerShell command Example

1

Get-MailboxJohn|FLalias,RetainDeletedItemsFor

7.4 – Display information about Deleted items policy for ALL users

PowerShell command Example

1

Get-Mailbox-ResultSizeUnlimited|FLalias,RetainDeletedItemsFor

Getting started with Office 365 PowerShell

PowerShell Naming Conventions & general information
Get more information about the Naming Conventions that are used in the PowerShell articles – Help and additional information – o365info.com PowerShell articles

Creating a remote PowerShell session to Exchange Online
To get more information about the required remote PowerShell commands that you need to use for connecting to Exchange Online, read the following article:
Connect to Exchange Online by using Remote PowerShell

Creating a remote PowerShell session to Azure Active Directory
To get more information about the required software component + the remote PowerShell commands that you need to use for connecting Azure Active Directory, read the following article: Part 2: Connect to Office 365 by using Remote PowerShell

Basic introduction to PowerShell in Office 365 based environment
If you are new in the PowerShell world, you can read more information about how to start working with PowerShell in Office 365 based environment in the following article series:  Getting started with Office 365 PowerShell – Part 1, Part 2, Part 3.

Running and using o365info PowerShell scripts
In case that you need more information about how to use the o365info PowerShell scripts that I add to the PowerShell articles, you can read the article – How to run and use o365info PowerShell menu script

Summary

Manage Retention Policy and Tags by using PowerShell | Office 365

Article Name

Manage Retention Policy and Tags by using PowerShell | Office 365

Description

In the current article, we will review how to use PowerShell commands for managing Retention Policy in Exchange Online environment.

Author

Eyal Doron

Publisher Name

o365info.com

Publisher Logo

o365info.com
Sours: https://o365info.com/manage-retention-policy-by-using/
  1. Lufkin elementary school
  2. Jt whatsapp link
  3. Priscilla shirer conference 2016

Get-Retention Policy Using PowerShell

The Get-RetentionPolicy cmdlet is used to fetch information about the mailbox retention policies, the details of the newly created and existing policies, and the ones applied for individual mailboxes. Find some simple examples of retention policy cmdlets below:

Example Get-RetentionPolicy cmdlets:

Get-RetentionPolicy -Identity "abc RP" | Format-List

This cmdlet is used to fetch information about the properties and settings of the abc RP retention policy. The result will be displayed in a list format.

Get-RetentionPolicy -DomainController “ExchangeDC1”

This cmdlet is used to generate a list of all retention policies in the domain controlled by the ExchangeDC1 domain controller.

These cmdlets are open-ended and simple. To generate more intricate information you may have to pipe the cmdlets with more parameters which complicates the coding. Instead you can choose to get all the data you need in easy to understand and presentable reports directly by using Exchange Reporter Plus in just a single click.

Getting insights about retention policies using Exchange Reporter Plus:

Exchange Reporter Plus, an Exchange reporting, change auditing and monitoring tool offers multiple reports that provide all the information you need to know about the retention policies.

List of Retention Policy reports available:

For Exchange Server:

Retention Policies Reports

    • Retention Policies:  Shows all the retention policies including when they were created and last modified.
    • No. of Mailboxes with Policies:  Shows the number of mailboxes associated with each retention policy.
    • Mailboxes with Policies: Lists the mailboxes associated with a specified retention policy.
    • Retention Policy Details: Shows the details of a specified retention policy.
    • Mailboxes without Retention Policies: Shows mailboxes that are not associated with any retention policy.

For Exchange Online:

General Mailbox Reports

    • Mailbox Retention Policy Details:   Lists all the retention policy details for all domains in your Office 365 tenant.

Mailbox Security Reports

    • Mailbox Retention Policy:  Lists all the retention policies set in your Office 365 tenant.

getting-insights-about-retention-policies

Steps to generate retention policy reports in Exchange Reporter Plus:

    • Navigate to Exchange Server > Mailboxes > Retention Policies Reports (for Exchange Server).

    Note: Navigate to Exchange Online > Mailbox Reports to generate Mailbox Retention Policy Details report.

    Or navigate to Exchange Online > Security Reports to run the Mailbox Retention Policy report for Exchange Online.

    • Enter the organization or Office 365 tenant  name.

    That’s it! You can have the complete information in just three simple steps.

generate-retention-policy-reports

generate-mailbox-retention-policy-reports

Highlights of Exchange Reporter Plus reports:

    • Report Scheduling:  Schedule reports to generate them automatically and send them to concerned authorities such as IT admins and managers through email.
    • Quick access and export options: Add reports as favourites to access them easily and export reports to different file formats: such as PDF, HTML, XLS and CSV.
    • Filter and alerting options: Add or remove columns from the report generated to view information relevent to your needs. Use advanced filters options available to customize your search and configure alerts for auditing and monitoring reports and receive immediate notifications through email or SMS.
    • Technician Delegation: Delegate different reports to different technicians. Have control over who gets access to what.
    • Easy-to-analyse reports: Generate reports on periodic basis, per domain basis, tenant-wise or get an overall summary as you choose. Get graphical and dashboard representation of complex analytical data.

Exchange Reporter Plus offers various reporting hacks that simplify the process of data gathering and saves a lot of productive time, click to learn more.

Office 365 Security Reports Office 365 Health Monitoring Exchange Audit Logs Skype for Business Reports

Sours: https://www.manageengine.com/products/exchange-reports/powershell/how-to-get-get-retention-policy-using-powershell.html
Mastering Office 365 with PowerShell - Session 7 - Troubleshoot Retention Policies \u0026 Retention Tags

Categories

Below is a list of useful commands we can use to view set retention policies on Office 365 mailboxes through Azure AD PowerShell.  Again, we will need to connect to the tenant using the Azure AD PowerShell module to make the setting changes.

These same commands can be used within an Exchange 2013 environment as well.

+++++

List all of the currently available retention policies and assigned retention tags…

Get-RetentionPolicy | ft -auto Name,RetentionPolicyTagLinks

 

List a retention policy currently set for an individual mailbox…

Get-Mailbox -Identity "USER_ALIAS" | ft Alias,RetentionPolicy

 

Get the list of retention policies set on all O365 mailboxes…

Get-Mailbox -ResultSize Unlimited | ft -auto Alias,RetentionPolicy

 

Set a retention policy for an individual O365 mailbox…

Set-Mailbox -Identity "USER_ALIAS" -RetentionPolicy "RETENTION_POLICY_NAME"

 

Set a retention policy on all O365 mailboxes…

Get-Mailbox -ResultSize Unlimited | Set-Mailbox -RetentionPolicy "RETENTION_POLICY_NAME"

 

Remove a retention policy from an individual mailbox…

Set-Mailbox -Identity "USER_ALIAS" -RetentionPolicy $null

 

Set an existing retention policy as the default retention policy for your organization.  This may or may not set the assigned policy permanently as the “IsDefault” parameter is reserved for internal Microsoft use. The default retention policy name in Exchange and Exchange Online is “Default MRM Policy“.

Set-RetentionPolicy -Identity "RETENTION_POLICY_NAME" -IsDefault:$True

 

Related Articles in this Blog:

 

Reference(s):

 

Like this:

LikeLoading...

8 July 2015 in Exchange 2013, Exchange Online. Tags: #msexchange, #office365, archive, archive mailboxes, azure ad, azure ad module, azure ad powershell, email lifecycle, ems, enable archive, enable-mailbox, enable-remotemailbox, exchange, exchange 2010, exchange 20103, exchange admin center, exchange hybrid, exchange management shell, exchange server, Get-RetentionPolicy, hybrid, in-place archive, mailbox, mailboxes, messaging records management, mrm, o365, office 365, powershell, retention, retention policies, retention policy, retention settings, retention tags, Set-RetentionPolicy, Start-ManagedFolderAssistantSours: https://oddytee.wordpress.com/2015/07/08/set-retention-policies-in-office-365-via-powershell/

Mailbox remove powershell policy from retention

Turn off or suspend messaging records management

Applies to: Exchange Server 2013

To meet individual, IT, or business requirements, you may need to turn off or temporarily suspend messaging records management (MRM) for an individual user or for a Mailbox server. Reasons you may need to turn off or suspend MRM include:

  • If a mailbox user is away from the office or is otherwise unable to access e-mail, you can temporarily disable MRM for the mailbox by placing it on retention hold. When a mailbox is on retention hold, it's no longer processed by the Managed Folder Assistant. When the mailbox user returns or is able to access the mailbox again, you can remove the retention hold from the mailbox.

  • If you need to test or troubleshoot performance issues, you can temporarily turn off MRM on that server by clearing the schedule for the Managed Folder Assistant.

  • If you need to remove a retention tag from mailboxes (which have a retention policy with that tag applied), you can remove the tag from the policy.

  • If you want a retention policy or a managed folder mailbox policy to no longer apply to a mailbox, you can remove the policy from the mailbox.

  • If your organization decides not to use MRM features, you can turn off MRM permanently for the entire organization. If you later decide to deploy MRM, you have the ability to do so.

What do you need to know before you begin?

  • Estimated time to complete: 1 minute

  • Procedures in this topic require specific permissions. See each procedure for its permissions information.

  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.

Having problems? Ask for help in the Exchange forums. Visit the forums at Exchange Server.

Place mailboxes on retention hold

You can place mailboxes on retention hold to turn off MRM temporarily (for example when users are on vacation). This suspends the processing of retention policies for the mailbox until retention hold is disabled. This is different from placing mailboxes on In-Place Hold or litigation hold.

For details about how to place a mailbox on retention hold, see Place a mailbox on retention hold.

To learn more about In-Place Hold and litigation hold, see In-Place Hold and Litigation Hold.

Remove retention tags from mailboxes

To remove a retention tag from a mailbox, you unlink the tag from the retention policy. When you unlink a retention policy tag (RPT) for a default folder, the default mailbox tag applies to all items in that folder. When you unlink a personal tag, it's no longer available to the user. Tags applied to existing messages will continue to be processed unless you remove the tag from the Exchange organization.

You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Messaging records management" entry in the Messaging policy and compliance permissions topic.

This Shell example unlinks the retention tag Delete - 3 Days from the retention policy Corp-Users.

For detailed syntax and parameter information, see Get-RetentionPolicy and Set-RetentionPolicy.

Remove retention policies from mailboxes

You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Apply retention policies" entry in the Messaging policy and compliance permissions topic.

You can stop a retention policy from applying to a mailbox by removing the policy from the mailbox user's properties.

This Shell example removes the retention policy from the mailbox jpeoples.

This Shell example removes the retention policy from all mailboxes in the Exchange organization.

This Shell example removes the retention policy Corp-Finance from all mailbox users who have the policy applied.

For detailed syntax and parameter information, see Set-Mailbox and Get-Mailbox.

Turn off MRM permanently for an entire organization

To turn off MRM for an organization, delete all retention tags and retention policies except for the ArbitrationMailbox policy, which is created by Exchange Setup. After this is complete, retention policies aren't enforced.

Warning

Retention policies also include Move to Archive tags, which move messages to the user's archive mailbox. If you remove a retention policy that has a Move to Archive tag, users who had the policy applied will no longer have messages moved to the archive by the Managed Folder Assistant.
To avoid this, remove only the Delete and Allow Recovery and Permanently Delete tags from your organization and keep the policies that have the Move to Archive tags applied. Alternatively, users who have and archive enabled could manually move items to their archive mailbox using Outlook or Outlook Web App.
Before removing retention tags or retention policies, we recommend that you check the settings of the tags being removed. Don't delete tags with the Move to Archive retention action.

You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Messaging records management" entry in the Messaging policy and compliance permissions topic.

Note

Include the WhatIf switch in the following commands to simulate the action taken by a command.

This example removes all delete tags from an Exchange organization except the Never Delete tag, which is used in the ArbitrationMailbox policy created by Exchange Setup.

This example removes all retention tags except the Never Delete tag.

This command removes the Corp-Users retention policy from an Exchange organization.

For detailed syntax and parameter information, see the following topics:

Sours: https://docs.microsoft.com/en-us/exchange/turn-off-or-suspend-messaging-records-management-exchange-2013-help
How To Move A Mailbox To A New Database In Exchange Using PowerShell

Create a Retention Policy

ms.localizationprioritydescriptionms.topicauthorms.authorms.assetidms.reviewerf1.keywordstitlems.collectionaudiencems.servicemanager

medium

In Exchange Online, you can use retention policies to manage email lifecycle. Retention policies are applied by creating retention tags, adding them to a retention policy, and applying the policy to mailbox users.

article

msdmaguire

jhendr

d8806c98-fea5-492f-906d-f514e25361b2

Create a Retention Policy

exchange-online

M365-email-calendar

ITPro

exchange-online

serdars

[!NOTE] To proactively retain or delete mailbox content for information governance in Microsoft 365, we recommend that you use retention policies and retention labels from the Microsoft 365 compliance center, instead of messaging records management that's described on this page. However, you should continue using messaging records management to move messages to archive mailboxes.

If you currently use messaging records management, this older feature will continue to work side-by-side with retention policies and retention labels. However, we recommend that going forward, you use retention policies and retention labels instead. They provide you with a single mechanism to centrally manage both retention and deletion of content across Microsoft 365.

In Exchange Online, you can use retention policies to manage email lifecycle. Retention policies are applied by creating retention tags, adding them to a retention policy, and applying the policy to mailbox users.

Here's a video that shows you how to create a retention policy and apply it to a mailbox in Exchange Online.

For additional management tasks related to retention policies, see Messaging Records Management Procedures.

What do you need to know before you begin?

  • Estimated time to complete this task: 30 minutes.

  • Procedures in this topic require specific permissions. See each procedure for its permissions information.

  • Mailboxes to which you apply retention policies must reside on Exchange Server 2010 or later servers.

  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts for the Exchange admin center.

Step 1: Create a retention tag

You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Messaging records management" entry in the Feature permissions in Exchange Online topic.

Use the EAC to create a retention tag

  1. Navigate to Compliance management > Retention tags, and then click AddAdd Icon.

  2. Select one of the following options:

    • Applied automatically to entire mailbox (default): Select this option to create a default policy tag (DPT). You can use DPTs to create a default deletion policy and a default archive policy, which applies to all items in the mailbox.

      [!NOTE] You can't use the EAC to create a DPT to delete voice mail items. For details about how to create a DPT to delete voice mail items, see Exchange Online PowerShell example below.

    • Applied automatically to a specific folder: Select this option to create a retention policy tag (RPT) for a default folder such as Inbox or Deleted Items.

      [!NOTE] You can only create RPTs with the Delete and allow recovery or Permanently delete actions.

    • Applied by users to items and folders (Personal): Select this option to create personal tags. These tags allow Outlook and Outlook on the web (formerly known as Outlook Web App) users to apply archive or deletion settings to a message or folders that are different from the settings applied to the parent folder or the entire mailbox.

  3. The New retention tag page title and options will vary depending on the type of tag you selected. Complete the following fields:

    • Name: Enter a name for the retention tag. The tag name is for display purposes and doesn't have any impact on the folder or item a tag is applied to. Consider that the personal tags you provision for users are available in Outlook and Outlook on the web.

    • Apply this tag to the following default folder: This option is available only if you selected Applied automatically to a specific folder.

    • Retention action: Select one of the following actions to be taken after the item reaches its retention period:

    • Delete and Allow Recovery: Select this action to delete items but allow users to recover them using the Recover Deleted Items option in Outlook or Outlook on the web. Items are retained until the deleted item retention period configured for the mailbox database or the mailbox user is reached.

    • Permanently Delete: Select this option to permanently delete the item from the mailbox database.

      [!IMPORTANT] Mailboxes or items subject to In-Place Hold or litigation hold will be retained and returned in In-Place eDiscovery searches. To learn more, see In-Place Hold and Litigation Hold.

    • Move to Archive: This action is available only if you're creating a DPT or a personal tag. Select this action to move items to the user's In-Place Archive.

    • Retention period: Select one of the following options:

    • Never: Select this option to specify that items should never be deleted or moved to the archive.

    • When the item reaches the following age (in days): Select this option and specify the number of days to retain items before they're moved or deleted. The retention age for all supported items except Calendar and Tasks is calculated from the date an item is received or created. Retention age for Calendar and Tasks items is calculated from the end date.

    • Comment: User this optional field to enter any administrative notes or comments. The field isn't displayed to users.

Use Exchange Online PowerShell to create a retention tag

Use the New-RetentionPolicyTag cmdlet to create a retention tag. Different options available in the cmdlet allow you to create different types of retention tags. Use the Type parameter to create a DPT (), RPT (specify a default folder type, such as ) or a personal tag ().

This example creates a DPT to delete all messages in the mailbox after 7 years (2,556 days).

New-RetentionPolicyTag-Name "DPT-Corp-Delete"-Type All -AgeLimitForRetention 2556-RetentionAction DeleteAndAllowRecovery

This example creates a DPT to move all messages to the In-Place Archive in 2 years (730 days).

New-RetentionPolicyTag-Name "DPT-Corp-Move"-Type All -AgeLimitForRetention 730-RetentionAction MoveToArchive

This example creates a DPT to delete voice mail messages after 20 days.

New-RetentionPolicyTag-Name "DPT-Corp-Voicemail"-Type All -MessageClass Voicemail -AgeLimitForRetention 20-RetentionAction DeleteAndAllowRecovery

This example creates a RPT to permanently delete messages in the Junk EMail folder after 30 days.

New-RetentionPolicyTag-Name "RPT-Corp-JunkMail"-Type JunkEmail -AgeLimitForRetention 30-RetentionAction PermanentlyDelete

This example creates a personal tag to never delete a message.

New-RetentionPolicyTag-Name "Never Delete"-Type Personal -RetentionAction DeleteAndAllowRecovery -RetentionEnabled $false

Step 2: Create a retention policy

You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Messaging records management" entry in the Feature permissions in Exchange Online topic.

Use the EAC to create a retention policy

  1. Navigate to Compliance management > Retention policies, and then click AddAdd Icon.

  2. In New Retention Policy, complete the following fields:

    • Name: Enter a name for the retention policy.

    • Retention tags: Click AddAdd Icon. to select the tags you want to add to this retention policy.

      A retention policy can contain the following tags:

      • One DPT with the Move to Archive action.

      • One DPT with the Delete and Allow Recovery or Permanently Delete actions.

      • One DPT for voice mail messages with the Delete and Allow Recovery or Permanently Delete actions.

      • One RPT per default folder such as Inbox to delete items.

      • Any number of personal tags.

      [!NOTE] Although you can add any number of personal tags to a retention policy, having many personal tags with different retention settings can confuse users. We recommend linking no more than ten personal tags to a retention policy.

You can create a retention policy without adding any retention tags to it, but items in the mailbox to which the policy is applied won't be moved or deleted. You can also add and remove retention tags from a retention policy after it's created.

Use Exchange Online PowerShell to create a retention policy

This example creates the retention policy RetentionPolicy-Corp and uses the RetentionPolicyTagLinks parameter to associate five tags to the policy.

New-RetentionPolicy"RetentionPolicy-Corp"-RetentionPolicyTagLinks "DPT-Corp-Delete","DPT-Corp-Move","DPT-Corp-Voicemail","RPT-Corp-JunkMail","Never Delete"

For detailed syntax and parameter information, see New-RetentionPolicy.

Step 3: Apply a retention policy to mailbox users

After you create a retention policy, you must apply it to mailbox users. You can apply different retention policies to different set of users. For detailed instructions, see Apply a retention policy to mailboxes.

How do you know this worked?

After you create retention tags, add them to a retention policy, and apply the policy to a mailbox user, the next time the MRM mailbox assistant processes the mailbox, messages are moved or deleted based on settings you configured in the retention tags.

To verify that you have applied the retention policy, do the following:

  1. Replace <Mailbox Identity> with the name, email address, or alias of the mailbox, and run the following command in Exchange Online PowerShell command to run the MRM assistant manually against a single mailbox:

    Start-ManagedFolderAssistant-Identity "<Mailbox Identity>"
  2. Log on to the mailbox using Outlook or Outlook on the web and verify that messages are deleted or moved to an archive in accordance with the policy configuration.

[!TIP] Having problems? Ask for help in the Exchange forums. Visit the forums at Exchange Online or Exchange Online Protection.

Sours: https://github.com/MicrosoftDocs/OfficeDocs-Exchange/blob/public/Exchange/ExchangeOnline/security-and-compliance/messaging-records-management/create-a-retention-policy.md

You will also like:

Remove-RetentionPolicy

This cmdlet is available in on-premises Exchange and in the cloud-based service. Some parameters and settings may be exclusive to one environment or the other.

Use the Remove-RetentionPolicy cmdlet to remove a retention policy.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

Syntax

Description

Retention policies are used to apply message retention settings to folders and items in a mailbox. The Remove-RetentionPolicy cmdlet removes an existing retention policy.

If you remove a retention policy that's assigned to users and they don't have another retention policy assigned, messages in those mailboxes may never expire. This may be a violation of the organization's messaging retention policies. When you attempt to remove a policy that's assigned to users, Microsoft Exchange displays a confirmation message indicating that the policy is assigned to users. Note that this message is in addition to the confirmation prompt displayed when removing a retention policy.

You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the permissions required to run any cmdlet or parameter in your organization, see Find the permissions required to run any Exchange cmdlet.

Examples

Example 1

This example removes the retention policy Business Critical.

Example 2

This example removes the retention policy Business Critical and suppresses the confirmation prompt.

Example 3

This example removes the retention policy Business Critical, which is assigned to users and suppresses the confirmation prompt.

Parameters

-Confirm

The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on if the cmdlet requires confirmation before proceeding.

  • Destructive cmdlets (for example, Remove-* cmdlets) have a built-in pause that forces you to acknowledge the command before proceeding. For these cmdlets, you can skip the confirmation prompt by using this exact syntax: .
  • Most other cmdlets (for example, New-* and Set-* cmdlets) don't have a built-in pause. For these cmdlets, specifying the Confirm switch without a value introduces a pause that forces you acknowledge the command before proceeding.
Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

-DomainController

This parameter is available only in on-premises Exchange.

The DomainController parameter specifies the domain controller that's used by this cmdlet to read data from or write data to Active Directory. You identify the domain controller by its fully qualified domain name (FQDN). For example, dc01.contoso.com.

Type:Fqdn
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019

-Force

The Force switch specifies whether to override the confirmation prompt that appears when removing a retention policy that's assigned to users. Removing a policy that's assigned to users results in those users not having any retention policy. You don't have to specify a value with the Force switch.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

-Identity

The Identity parameter specifies the retention policy name.

Type:MailboxPolicyIdParameter
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

-WhatIf

The WhatIf switch simulates the actions of the command. You can use this switch to view the changes that would occur without actually applying those changes. You don't need to specify a value with this switch.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Server 2010, Exchange Server 2013, Exchange Server 2016, Exchange Server 2019, Exchange Online

Inputs

To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn't accept input data.

Outputs

To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn't return data.

Sours: https://docs.microsoft.com/en-us/powershell/module/exchange/remove-retentionpolicy


2290 2291 2292 2293 2294