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 June 7, 2025 11:43

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

Supercharging Your Network Diagnostics with Globalping for NET

Ever wondered how to run network diagnostics like Ping, Traceroute, or DNS queries from probes…

5 days ago

Automating Network Diagnostics with Globalping PowerShell Module

Are you tired of manually running network diagnostics like Ping, Traceroute, or DNS queries? The…

5 days ago

Enhanced Dashboards with PSWriteHTML – Introducing InfoCards and Density Options

Discover new features in the PSWriteHTML PowerShell module – including New-HTMLInfoCard, improved layout controls with…

2 weeks ago

Mastering Active Directory Hygiene: Automating SIDHistory Cleanup with CleanupMonster

Security Identifier (SID) History is a useful mechanism in Active Directory (AD) migrations. It allows…

2 weeks ago

Upgrade Azure Active Directory Connect fails with unexpected error

Today, I made the decision to upgrade my test environment and update the version of…

2 weeks ago

Mastering Active Directory Hygiene: Automating Stale Computer Cleanup with CleanupMonster

Have you ever looked at your Active Directory and wondered, "Why do I still have…

2 weeks ago