PowerShell

Office 365 – The following error occurred during validation in agent Archive ParameterSet Enforcement Agent

I just created 80 Azure AD users via PowerShell that I wanted to activate for email. Normally you can use Enable-Mailbox when using Exchange On-Premises to activate Active Directory based user (who don't yet have mailboxes so it seem obvious this would be command I need. Quick look for Enable-Mailbox on Microsoft website doesn't have big warning sign to not use it.. so I did….

The command I used was

foreach ($User in $UsersNonExistantAzure) {
    Enable-Mailbox -Identity $User.MailNickName -WhatIf
}

To my surprise following errors occurred

WARNING: After you create a new mailbox, you must go to the Office 365 Admin Center and assign the mailbox a license, or it will be disabled after the grace period.
The following error occurred during validation in agent ‘Archive ParameterSet Enforcement Agent': ‘This operation only works with Archive or PermanentlyDisable parameters.'
+ CategoryInfo : NotSpecified: (:) [Enable-Mailbox], ProvisioningValidationException
+ FullyQualifiedErrorId : [Server=VI1P194MB0094,RequestId=b9b8a0e8-c2bc-4397-be24-dd57dfe04107,TimeStamp=26.09.2018 19:39:32] [FailureCategory=Cmdlet-ProvisioningValidat
ionException] 1BD65423,Microsoft.Exchange.Management.RecipientTasks.EnableMailbox
+ PSComputerName : outlook.office365.com

How can I fix it?

If you're on-premises the fix is simple that you should use this command on your local Microsoft Exchange. However I wasn't. But the fix is actually as simple as it get. Just assign a license to a user!

Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -AddLicenses "evotec:ENTERPRISEPACK"

After I did… things went smoothly

And mailboxes started showing up on Exchange Online

This post was last modified on 26 września, 2018 22:11

Przemyslaw Klys

System Architect with over 14 years of experience in the IT field. Skilled, among others, in Active Directory, Microsoft Exchange and Office 365. Profoundly interested in PowerShell. Software geek.

Share
Published by
Przemyslaw Klys

Recent Posts

Active Directory Replication Summary to your Email or Microsoft Teams

Active Directory replication is a critical process that ensures the consistent and up-to-date state of…

2 tygodnie ago

Syncing Global Address List (GAL) to personal contacts and between Office 365 tenants with PowerShell

Hey there! Today, I wanted to introduce you to one of the small but excellent…

5 miesięcy ago

Active Directory Health Check using Microsoft Entra Connect Health Service

Active Directory (AD) is crucial in managing identities and resources within an organization. Ensuring its…

7 miesięcy ago

Seamless HTML Report Creation: Harness the Power of Markdown with PSWriteHTML PowerShell Module

In today's digital age, the ability to create compelling and informative HTML reports and documents…

8 miesięcy ago

How to Efficiently Remove Comments from Your PowerShell Script

As part of my daily development, I create lots of code that I subsequently comment…

9 miesięcy ago

Unlocking PowerShell Magic: Different Approach to Creating ‘Empty’ PSCustomObjects

Today I saw an article from Christian Ritter, "PowerShell: Creating an "empty" PSCustomObject" on X…

9 miesięcy ago