# 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…

blog

26 Sep 2018 pl

![Office 365 – The following error occurred during validation in agent Archive ParameterSet Enforcement Agent](/wp-content/uploads/2018/09/img_5babe3fc37b8d.png)

[Zobacz obrazy (3)](#pf-content-image-1-0)

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](https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/enable-mailbox?view=exchange-ps) **doesn't have big **warning **sign to not use it.. so I did….

[!\[Polecenie Enable-Mailbox uruchomione dla uzytkownikow Azure AD w Office 365 przed poprawka zwiazana z licencjonowaniem skrzynek.\](/wp-content/uploads/2018/09/img_5babe3fc37b8d.png)](/wp-content/uploads/2018/09/img_5babe3fc37b8d.png)

The command I used was

```powershell
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

[!\[Blad PowerShell w Office 365 pokazujacy problem walidacji Archive ParameterSet Enforcement Agent przy Enable-Mailbox.\](/wp-content/uploads/2018/09/img_5babe229d6163.png)](/wp-content/uploads/2018/09/img_5babe229d6163.png)

### 💡 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!

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

After I did… things went smoothly

[!\[Lista skrzynek w Exchange Online po przypisaniu licencji uzytkownikom i poprawnym zakonczeniu aktywacji.\](/wp-content/uploads/2018/09/img_5babe76e0d363.png)](/wp-content/uploads/2018/09/img_5babe76e0d363.png)

And **mailboxes **started showing up on **Exchange Online**

## Powiązane projekty

Projekty powiązane z tagami, kategoriami i treścią tego wpisu.

[Wszystkie projekty](/projekty/)

Trwa dopasowywanie projektów...

[Powrót do bloga](/blog/)

## Powiązane wpisy

- [Check an API write after a PowerShell timeout](/blog/verify-uncertain-api-outcomes-powershell/)
- [Inspect and convert mixed Office archives with PSWriteOffice](/blog/inspect-and-convert-mixed-office-archives-pswriteoffice/)
- [Compose PDF reports and automate page workflows with PSWriteOffice](/blog/automate-pdf-reports-and-page-workflows-pswriteoffice/)

<!-- PowerForge markdown artifact sha256:51F42D1F01501C9C04EEF7BC726688E6C401F1386FD129439CA72E4497ADF685 -->
