Skip to main content

Compliance helpers

Requires an EXO session with Purview Compliance PowerShell availability (Connect-IPPSSession). For full details and examples, run Get-Help <FunctionName> -Detailed.

Get-MboxMrmCleanup

List retention policies used by MRM cleanup workflows, with linked tag details shown inline.

By default, Nebula.Core limits the inventory to temporary objects created by Set-MboxMrmCleanup. Use -AllTenantObjects to list every retention policy in the tenant. Use -Detailed when you want the linked tag names and assigned mailbox lists in the output.

Syntax

Get-MboxMrmCleanup [-Identity <String[]>] [-AllTenantObjects] [-Detailed]
ParameterTypeDescriptionRequiredDefault
Identity (Name, TagName, PolicyName)String[]Policy name or linked tag name to inspect. When omitted, temporary cleanup policies are listed.No-
AllTenantObjectsSwitchInclude every retention tag and policy in the tenant.NoFalse
DetailedSwitchInclude linked tag names and assigned mailbox lists.NoFalse

Examples

Get-MboxMrmCleanup
Get-MboxMrmCleanup -Detailed
Get-MboxMrmCleanup -AllTenantObjects
Get-MboxMrmCleanup -Identity 'OneShot_PreCutoff_20250101'

:::note What the inventory shows Each row represents a retention policy and includes the linked tag details inline, plus the number of mailboxes currently using that policy. :::

Remove-MboxMrmCleanup

Restore affected mailboxes to a standard retention policy or to the default mailbox behavior, then remove temporary cleanup tags and policies.

Use -Identity to target a specific temporary tag or policy. If you omit -Identity, Nebula.Core targets all temporary objects whose names start with OneShot_PreCutoff_. Use -RestorePolicyName to move mailboxes to a known standard policy before deletion, or -ClearRetentionPolicy to remove the mailbox-level assignment altogether. The restore policy name must match the exact retention policy name in the tenant.

Syntax

Remove-MboxMrmCleanup [-Identity <String[]>] [-Mailbox <String[]>] [-RestorePolicyName <String>] [-ClearRetentionPolicy] [-RemoveTag <Boolean>] [-RemovePolicy <Boolean>]
ParameterTypeDescriptionRequiredDefault
Identity (Name, TagName, PolicyName)String[]Temporary cleanup tag or policy to remove.No-
Mailbox (UserPrincipalName, IdentityMailbox, SourceMailbox)String[]Optional mailbox list to restore before deleting the cleanup policy.No-
RestorePolicyNameStringStandard retention policy to assign back to the mailbox or mailboxes.No-
ClearRetentionPolicySwitchClear the mailbox retention policy instead of assigning another one.NoFalse
RemoveTagBooleanRemove the retention policy tag after cleanup.NoTrue
RemovePolicyBooleanRemove the retention policy after affected mailboxes are restored.NoTrue

Examples

Remove-MboxMrmCleanup -Identity 'OneShot_PreCutoff_20250101'
Remove-MboxMrmCleanup -PolicyName 'OneShot_PreCutoff_20250101' -RestorePolicyName 'Default MRM Policy'
'user@contoso.com' | Remove-MboxMrmCleanup -Identity 'OneShot_PreCutoff_20250101' -ClearRetentionPolicy

:::warning Removal safety Before removing a tag or policy, Nebula.Core tries to restore the impacted mailbox assignments first. If a policy is still linked elsewhere, the cmdlet warns you instead of deleting it blindly. :::

Search-MboxCutoffWindow

Create/reuse a Purview Compliance Search to isolate mailbox items by date criteria (estimate + optional preview sample).

Syntax

Search-MboxCutoffWindow -Mailbox <String> [-Mode <String>] [-CutoffDate <DateTime>] [-ExistingSearchName <String>] [-UseExistingOnly] [-Preview] [-PreviewCount <Int32>] [-PollingSeconds <Int32>] [-MaxWaitMinutes <Int32>]
Search-MboxCutoffWindow -Mailbox <String> -Mode Range -StartDate <DateTime> -EndDate <DateTime> [-ExistingSearchName <String>] [-UseExistingOnly] [-Preview] [-PreviewCount <Int32>] [-PollingSeconds <Int32>] [-MaxWaitMinutes <Int32>]
ParameterTypeDescriptionRequiredDefault
Mailbox (Identity, UserPrincipalName, SourceMailbox)StringTarget mailbox. Pipeline accepted.Yes-
ModeStringBeforeCutoff (default) or Range.NoBeforeCutoff
CutoffDateDateTimeCutoff date used when Mode BeforeCutoff.No2025-01-01
StartDateDateTimeRange start date (used with Mode Range).Yes (Range)-
EndDateDateTimeRange end date, exclusive (used with Mode Range).Yes (Range)-
ExistingSearchNameStringReuse an existing Purview Compliance Search name.No-
UseExistingOnlySwitchDo not create/modify search definition; run estimate/preview on existing search only.NoFalse
PreviewSwitchCreate a Purview Preview action and return sampled lines.NoFalse
PreviewCountInt32Max preview sample lines to return.No50
PollingSecondsInt32Poll interval while waiting for completion.No10
MaxWaitMinutesInt32Maximum wait time before timeout.No60

Examples

Search-MboxCutoffWindow -Mailbox 'user@contoso.com' -Mode BeforeCutoff -CutoffDate '2025-01-01'
Search-MboxCutoffWindow -Mailbox 'user@contoso.com' -Mode Range -StartDate '2025-01-01' -EndDate '2025-02-01' -Preview -PreviewCount 25
Search-MboxCutoffWindow -Mailbox 'user@contoso.com' -ExistingSearchName 'Isolate_Pre_20250101_140530' -UseExistingOnly

Set-MboxMrmCleanup

Apply a one-shot MRM cleanup policy/tag to a mailbox (optional Managed Folder Assistant trigger). The cmdlet also returns the mailbox's previous retention policy, a ready-to-use rollback command, and removal hints for the temporary tag and policy.

Syntax

Set-MboxMrmCleanup -Mailbox <String> [-FixedCutoffDate <DateTime>] [-SafetyBufferDays <Int32>] [-RetentionAction <String>] [-TagName <String>] [-PolicyName <String>] [-RunAssistant]
ParameterTypeDescriptionRequiredDefault
Mailbox (Identity, UserPrincipalName, SourceMailbox)StringTarget mailbox. Pipeline accepted.Yes-
FixedCutoffDateDateTimeFixed date used to compute AgeLimitForRetention days.No2025-01-01
SafetyBufferDaysInt32Additional days added as safety buffer.No7
RetentionActionStringDeleteAndAllowRecovery (default) or PermanentlyDelete.NoDeleteAndAllowRecovery
TagNameStringRetention policy tag name (auto-generated if omitted).No-
PolicyNameStringRetention policy name (auto-generated if omitted).No-
RunAssistantSwitchTrigger Managed Folder Assistant (Start-ManagedFolderAssistant -FullCrawl) after assignment.NoFalse

Examples

Set-MboxMrmCleanup -Mailbox 'user@contoso.com' -FixedCutoffDate '2025-01-01' -SafetyBufferDays 7
Set-MboxMrmCleanup -Mailbox 'user@contoso.com' -RetentionAction PermanentlyDelete -RunAssistant -WhatIf