Enabling in-place archive for all users with PowerShell

Source: https://lazyadmin.nl/it/enabling-in-place-archive-for-all-users-with-powershell/

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:

#Create credential object
$credObject = Get-Credential

#Import the Exchange Online ps session
$ExchOnlineSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credObject -Authentication Basic -AllowRedirection
Import-PSSession $ExchOnlineSession

Or with the connector script:


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

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

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

Or for all users at once with

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

more info: https://technet.microsoft.com/en-us/library/jj984357%28v=exchg.150%29.aspx?f=255&MSPPError=-2147217396


Close Menu