Office365 - Inactive Mailboxes


For a while now I have been supporting an Office365 installation for a local charity.
We started off with E3 licences on the non-profit rate which gave us access to all the online service plus an Office2013 license for installation on PC’s.

We have grown to a size where occasionally people leave, when that happens we have two requirements:
- retaining their mail data for a short period of time and
- reusing or releasing their license as soon as possible to reduce our costs.

This is how we achieve those objectives, all in Powershell (NB: requires an E3 license)

# Place use on hold and remove license - retained for 7 years - or until hold removed.
# Where First-Last-Hold" is just a name for the search, we user First name-Last name-Hold as a convention.

New-MailboxSearch “First-Last-Hold” –SourceMailboxes “first.last@example.org.uk” –InPlaceHoldEnabled $True –ItemHoldPeriod 2557

If the user does not have an E3 license you will see this error:

You don't have the correct permissions to place the mailbox "First Last" on In-Place Hold because it's outside the scope of mailboxes
you can place on hold. One possible reason is the mailbox doesn't have a license for In-Place Hold. To get permissions, contact your admini
strator.
    + CategoryInfo          : InvalidOperation: (:) [], TaskInvalidOperationException
    + FullyQualifiedErrorId : [Server=DB5PR03MB1624,RequestId=0f7f8900-eddb-4062-86e8-668004ca0815,TimeStamp=11/04/2016 12:04:42] [Failure
   Category=Cmdlet-TaskInvalidOperationException] EC14B267

New-MailboxSearch “First-Last-Hold” –SourceMailboxes “first.last@example.org.uk” –InPlaceHoldEnabled $True –ItemHoldPeriod 2557

WARNING: The hold setting may take up to 60 minutes to take effect.

Name                               CreatedBy                          InPlaceHoldEnabled                 Status
----                               ---------                          ------------------                 ------
First-Last-Hold                    S-1-5-21-1055359317-2347530276-... True                               NotStarted

# Check status

Get-MailboxSearch

Name                               CreatedBy                          InPlaceHoldEnabled                 Status
----                               ---------                          ------------------                 ------
First-Last-Hold                    S-1-5-21-1055359317-2347530276-... True                               NotStarted

# Manually remove inactive mailbox

Set-MailboxSearch "First-Last-Hold" –InPlaceHoldEnabled $False
Remove-MailboxSearch "First-Last-Hold"
Comment on this article using form below. Requires email login only for authentication. HTML forbidden, Markdown only.