I am retrieving data from remote computers using WMI and the data can sometimes be larger than the default max envelope size.
I have increased the default size using winrm set winrm/config @{MaxEnvelopeSizekb=“2048”} but when I call Invoke-CimMethod or Invoke-WSManAction I get an error “Invoke-CimMethod : The WS-Management service cannot process the request.The computed response packet size (533115) exceeds the maximum envelope size that is allowed (512000).”
I have also tried using CimSessionOption to specify the size but it gives the same error.
$CitrixRsopProviderClass = Get-CimClass -Namespace root\rsop -ClassName CitrixRsopProviderClass $options = New-CimSessionOption -MaxEnvelopeSizeKB 2048 $session = New-CimSession -ComputerName $Computer -SessionOption $options $wmiC = Invoke-CimMethod -CimClass $CitrixRsopProviderClass -MethodName GetRsopRawData -Arguments @{'IsComputer'=$true;'username'=""} -CimSession $session $wmiU = Invoke-CimMethod -CimClass $CitrixRsopProviderClass -MethodName GetRsopRawDataForSession -Arguments @{'sessionId'=1} -CimSession $session
However, using Invoke-WmiMethod does work, as does running the command using WMIC.
$wmiC = Invoke-WmiMethod -Class CitrixRsopProviderClass -Name GetRsopRawData -Namespace root\rsop -ComputerName $Computer -ArgumentList $true,"" $wmiU = Invoke-WmiMethod -Class CitrixRsopProviderClass -Name GetRsopRawDataForSession -Namespace root\rsop -ComputerName $Computer -ArgumentList 1
Is this a bug or is there some other reason that MaxEnvelopeSize is not being respected? I have tried using PowerShell 4 and 5, on Windows 7 x64.