A Simple One Line script on a scheduled task will help you automate enabling archive mailboxes in Office 365. The below example checks for a custom attribute, archive status and enables a set of users in a specific OU. you can change as per your needs. In my case, this custom attribute is mapped to enable licenses dynamically.
# Include Exchange Powershell Module Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn #Lists All Remote Mailboxes #Checks Archive Status #Check License #Enable Archive Mailboxes Get-RemoteMailbox | Where-Object {($_.OnPremisesOrganizationalUnit -like "azure365pro.com/01 Users*") -and ($_.Ar chiveStatus -like "None") -and ($_.CustomAttribute15 -like "O365*")} | Enable-RemoteMailbox -Archive # Exit Exchange Powershell Module Remove-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
But for new users, every time administrators cannot keep checking to make sure Archive mailbox is enabled for my E3 and E5 users. it would be tiring to do it manually every time. So if require you can run it on a task scheduler so that it enables archive mailbox for all my E3 and E5 users.
Supported on Exchange 2013 or above | On-Premise Exchange Hybrid Server
NOTE: Before running the script run the below commands to check which are the mailboxes it will apply to
You can use Task Scheduler
Create Basic Task
Choose Daily
Set a time
Start a Program
- Powershell
- C:\Scripts\Enable_Archive_Mailbox.ps1
Made to stop the task if it exceeds 4 hours