WSMan, ограничение сессий
Вероятно, все в курсе, что для PowerShell Remoting использует WinRM, который, в свою очередь, базируется на открытом стандарте DMFT — WSMan. Выполняя те или иные задачи с помощью PowerShell Remoting, можно столкнуться со следующей ошибкой:
[localhost] Connecting to remote server failed with the following error me
ssage : The WS-Management service cannot process the request. This user is
allowed a maximum number of 5 concurrent shells, which has been exceeded.
Close existing shells or raise the quota for this user. For more informat
ion, see the about_Remote_Troubleshooting Help topic.
- CategoryInfo : OpenError: (System.Manageme....RemoteRunspa
ce:RemoteRunspace) [], PSRemotingTransportException - FullyQualifiedErrorId : PSSessionOpenFailed
Ошибка связана с превышением числа сессий, ограниченных пятью подключениями из соображений безопасности. Впрочем, необходимость убрать это ограничение, нужно сделать следующее:
PS> cd WSMan:\localhost\Shell
PS> dir
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Shell
WARNING: column "Type" does not fit into the display and was removed.
Name Value
AllowRemoteShellAccess true
IdleTimeout 180000
MaxConcurrentUsers 5
MaxShellRunTime 2147483647
MaxProcessesPerShell 15
MaxMemoryPerShellMB 150
MaxShellsPerUser 5
В приведенной конфигурации в данной ситуации интересен параметр MaxShellsPerUser. Для увеличения его значения, выполняется следующий командлет
PS> Set-Item .\MaxShellsPerUser 10