Had a customer who reported “The maximum number of sessions for the current user has been reached.” When executing the AddUsersToPFRecursive.ps1 cmdlet which allows you to specify permissions for the client user.

 

This is the powershell command and error code:

Problem Description: [PS] C:\program files\microsoft\exchange server\v14\scripts>.\AddUsersToPFRecursive.ps1 -TopPublicFolder "***" -User "**" -Permission publishingeditor

    + CategoryInfo          : NotSpecified: (0:Int32) [Get-PublicFolder], MapiLogonFailedException

    + FullyQualifiedErrorId : 4B083485,Microsoft.Exchange.Management.MapiTasks.GetPublicFolder

 

To resolve this issue, we recommend that you first determine whether the MAPI session limit is reached because of potential abuse, because a large additional mailbox was added, because it is the result of a bug in a client program, or because of client program design. You can override this by making some changes into the registry and allow further sessions to be created, to do this:

 

1.Start Registry Editor.

2.Locate, and then click to select the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services|MSExchangeIS\ParametersSystem.

3.If the Maximum Allowed Sessions Per User does not exist, do the following:

a.On the Edit menu, point to New, and then select DWORD Value.

b.Type Maximum Allowed Sessions Per User as the entry names, and then press Enter.

4.Right-click Maximum Allowed Sessions Per User, and then click Modify.

5.Click Decimal, type 5000 that you want to set in the Value data box, and then click OK.

6.Exit Registry Editor.

 

The issue above was resolved by performing the steps above but also specifying the –server ** parameter (which specifies the mailbox server that hosts the PF store) in the command and all was well.