WinRM / WS-Management error

November 9th, 2011 | Tags:

После создания удалённой сессии powershell к серверу с Exchange (типа New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://exchangesrv/PowerShell/ bla-bla-bla) и попытке передать туда гигазы данных получаем следующую ошибку:

Starting a command on remote server failed with the following error message : The WinRM client sent a request to the remote WS-Management service and got a response saying the request was too large. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OperationStopped(System.Manageme…pressionSyncJob:PSInvokeExpressionSyncJob) [], PSRemotingTransportException
    + FullyQualifiedErrorId : JobFailure

В логах IIS при этом имеем 413–ю и 500–ю ошибки HTTP.

 

Лечится эта красота кручением глубоко закопанного параметра uploadReadAheadSize, который по умолчанию равен 49152 байтам. Например:

C:\Windows\System32\inetsrv>appcmd.exe set config “Default Web Site/Powershell” -section:system.webserver/serverruntime /uploadreadaheadsize:10485760 /commit:apphost
Applied configuration changes to section “system.webServer/serverRuntime” for “MACHINE/WEBROOT/APPHOST/Default Web Site/Powershell” at configuration commit path
 “MACHINE/WEBROOT/APPHOST”

Comments are closed.