Hi, Guys follow this article to create a custom email archive policy for specific or all M365 Exchange Online mailboxes to instantly free up the Primary mailbox which helps you to prevent email bounce issues due to mailbox space full issue.
Before starting this please ensure you have a valid Exchange Online Archiving license assigned to the Mailbox or Mailbox has a valid Exchange Online Plan 2 license which is a prerequisite of this process.
Please change adminid@domain.com with your admin ID then run these commands to install the ExchangeOnlineManagement PowerShell module and login via your admin ID to M365 Exchange Online account it will ask for a password enter your password and hit the Sign in button.
1 2 3 4 5 |
Install-PackageProvider -Name NuGet -Scope CurrentUser Set-ExecutionPolicy RemoteSigned -Scope CurrentUser Install-Module -Name PowerShellGet -Force Install-Module -Name ExchangeOnlineManagement -Force Connect-ExchangeOnline -UserPrincipalName adminid@domain.com |
Run below Powershell command to list exiting Retention Tags.
6 |
Get-RetentionPolicyTag |
Run below Powershell command to create your custom Retention Tag by changing the name of Tag and Archiving days as per your requirement, one Retention Policy can have multiple Retention Tags this will be one of them.
9 |
New-RetentionPolicyTag "Six Months Archive Tag" -Type All -RetentionEnabled $true -AgeLimitForRetention 183 -RetentionAction MoveToArchive |
Run below Powershell command to list exiting Retention Policies.
8 |
Get-RetentionPolicy |
Run below Powershell command to create a custom archive Retention Policy using your custom Retention Tag.
7 |
New-RetentionPolicy "Six Months Archive Policy" -RetentionPolicyTagLinks "Six Months Archive Tag" |
Run below Powershell command to show full details of the particular mailbox.
8 |
Get-Mailbox -identity test@cloudgopala.com | FL |
Run below Powershell command to show Mailboxe used space
9 |
Get-Mailbox -identity test@cloudgopala.com | get-mailboxstatistics | ft displayname, totalitemsize |
Run below Powershell command to show current archive policy
10 |
Get-Mailbox -identity test@cloudgopala.com | FL RetentionPolicy |
Run below Powershell command to apply your newly create archive policy to the mailbox
11 |
Set-Mailbox -identity test@cloudgopala.com -RetentionPolicy "Six Months Archive Policy" |
Run below Powershell command to check archive policy apply successfully to the mailbox.
12 |
Get-Mailbox -identity test@cloudgopala.com | FL RetentionPolicy |
Run below Powershell command and check the archive is enabled or not on the mailbox.
13 |
Get-Mailbox -identity test@cloudgopala.com | FL ArchiveStatus |
Run below Powershell command if the archiving is not enabled on the mailbox.
14 |
Enable-Mailbox -Identity test@cloudgopala.com -Archive |
Run below Powershell command to check archiving mailbox auto-expanding future is enabled or not.
15 |
Get-Mailbox test@cloudgopala.com | FL AutoExpandingArchiveEnabled |
Run below Powershell command to enable auto-expanding of archiving mailbox, Please make sure you assigned a valid Exchange Online Plan 2 or Exchange Online Archiving license to the mailbox.
16 |
Enable-Mailbox test@cloudgopala.com -AutoExpandingArchive |
Finally, run the below Powershell command to manually trigger the archiving process on the mailbox.
17 |
Start-ManagedFolderAssistant -identity test@cloudgopala.com |
Run below Powershell command to check mailbox usage size.
18 |
Get-Mailbox -identity test@cloudgopala.com | get-mailboxstatistics | ft displayname, totalitemsize |
Once you are done with the above steps you can run the below PowerShell commands to apply the same archive policy to any other mailbox on day to day basis.
Run below PowerShell commands and login into the exchange online admin account.
1 2 3 4 5 |
Install-PackageProvider -Name NuGet -Scope CurrentUser Set-ExecutionPolicy RemoteSigned -Scope CurrentUser Install-Module -Name PowerShellGet -Force Install-Module -Name ExchangeOnlineManagement -Force Connect-ExchangeOnline -UserPrincipalName adminid@domain.com |
Run below Powershell command to apply your archive policy to the mailbox.
4 |
Set-Mailbox -identity test@cloudgopala.com -RetentionPolicy "Six Months Archive Policy" |
Run below Powershell command to enable archiving on the mailbox.
5 |
Enable-Mailbox -Identity test@cloudgopala.com -Archive |
Run below Powershell command to enable auto-expanding of archiving mailbox.
6 |
Enable-Mailbox test@cloudgopala.com -AutoExpandingArchive |
Run the below Powershell command to manually trigger the archiving process on the mailbox.
7 |
Start-ManagedFolderAssistant -identity test@cloudgopala.com |
Run below Powershell command to check mailbox usage size
8 |
Get-Mailbox -identity test@cloudgopala.com | get-mailboxstatistics | ft displayname, totalitemsize |
You have applied your custom arching policy to the mailbox.
I hope you found this informative and helpful.
Thank You for reading this Custom Archive Policy Article.