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:

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

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

Get more stuff like this

IT, Office365, Smart Home, PowerShell and Blogging Tips

I hate spam to, so you can unsubscribe at any time.

Leave a Comment