Applies ToExchange Online

Symptoms

When you run scripts or cmdlets by using Microsoft Exchange Online through remote PowerShell to modify large data sets, you experience either or both of the following symptoms:

  • Scripts or cmdlets take a long time to run.

  • You see the following throttling warning message in Exchange Online PowerShell:

    WARNING: Micro delay applied. Actual delayed: <X> msecs, ... WARNING: Micro delay applied. Actual delayed: <X> msecs, Enforced

Cause

This behavior is by design. The throttling is used to prevent malicious or unintentional attacks against the service that could affect Service Level Agreements. You can safely ignore the warning message.

Workaround

To work around this behavior, try the following options in the given order.

Option 1

Run a self-help diagnostic in the Microsoft 365 admin center to update the Exchange Remote PowerShell throttling policy for your tenant. For details, see Self-help diagnostics for issues in Exchange Online and Outlook.

Option 2

Use Exchange Online PowerShell V2 cmdlets to run the job. For details, see About the Exchange Online PowerShell V2 module.

Option 3

Add the following sleep element to the scripts or cmdlets. This element slows the script or cmdlet to within the boundaries of the throttling limit.Start-Sleep -m <Time in milliseconds> In the following example, the list of mailboxes that are retrieved by using the Get-Mailbox cmdlet are stored in a variable. This variable is used to run an action on all the mailboxes. This kind of job is typically throttled. By adding the sleep element to the cmdlet, you can try to stay within the boundaries of the throttling limit.$MB=get-mailbox -resultsize unlimited $MB | %{Set-Mailbox $_.identity -CustomAttribute8 "Test"; Start-Sleep -m 500}

Option 4

Use the RobustCloudCommand module to run the scripts or cmdlets. You can install this module by using the built-in Install-Module cmdlet. Here's an example of the process that uses the RobustCloudCommand module to add permissions to multiple public folders:

  1. Export the list of public folders to the PFList.csv file by running the following cmdlet:Invoke-Command -Scriptblock {Get-PublicFolder -Recurse -Resultsize Unlimited | Select-Object -property Name,Identity} -Session (Get-Pssession) |Export-csv -Path C:\Temp\PFList.csv -NoTypeInformation

  2. Install the RobustCloudCommand module by running the following cmdlet:Install-Module -Name RobustCloudCommand -Force

  3. Import the list of public folders that was generated in step 1 to the $PFList variable by running the following cmdlet:$PFList = Import-Csv C:\Temp\PFList.csv

  4. Add permissions for each public folder in the $PFList variable by running the following cmdlet. This cmdlet creates the LogFileName log that contains the details of the cmdlet and any errors that may occur.Start-RobustCloudCommand -LogFile C:\Temp\LogFileName.log -Recipients $PFList -ScriptBlock {Add-PublicFolderClientPermission -Identity $input.identity.tostring() -User User@Contoso.com -AccessRights CreateItems} -IdentifyingProperty Identity -UserPrincipalName Admin@contoso.com

Note: Typically, these cmdlets can run for hours or even days, depending on the number of objects that are modified.

More information

Still need help? Go to Microsoft Community.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.