Skip to main content

Enabling in-place archive for all users with PowerShell

By April 8, 2023No Comments

The In-Place Archive that you get with Exchange Online, provides your users with additional storage space. With PowerShell we can enable the archive mailboxes quickly for all users.

Connect to Exchange Online

First we need to connect to Exchange Online, you can use this connector script or run the following code:

1.  #Create credential object
2.  $credObject = Get-Credential
4.  #Import the Exchange Online ps session
5.  $ExchOnlineSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $credObject -Authentication Basic -AllowRedirection
6.  Import-PSSession $ExchOnlineSession

Or with the connector script:

1.  ConnectTo-ExchangeOnline.ps1

Get a list of users without In-place Archive

To check if there are users without the archive mailbox, you can run the following cmdlet

1.  Get-Mailbox -Filter {ArchiveStatus -Eq "None" -AND RecipientTypeDetails -eq "UserMailbox"}

Enabling the archive

You can enable the archive for a single user with the following cmdlet

1.  Enable-Mailbox -Identity "<user>" -Archive

Or for all users at once with

1.  Get-Mailbox -Filter {ArchiveStatus -Eq "None" -AND RecipientTypeDetails -eq "UserMailbox"} | Enable-Mailbox -Archive

more info: