Welcome › Forums › General PowerShell Q&A › Invoke-CimMethod ignoring MaxEnvelopeSizeKb
This topic contains 3 replies, has 2 voices, and was last updated by
-
AuthorPosts
-
September 13, 2015 at 1:28 am #29721
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.
-
September 14, 2015 at 5:21 am #29733
If the default MaxEnvelopeSizeKB is 512000, why would you set it to 2048? If your response is 533115, you should set the MaxEnvelopeSizeKB to 600000 to return the record. If the passed value is less than the default MaxEnvelopeSizeKB, it is possible that it's ignored as you would traditionally set it higher, not lower than the current default limit.
-
September 14, 2015 at 7:10 am #29738
I believe the numbers in the error message are in bytes, but when you set the MaxEnvelopeSize option it is in kilobytes – hence 2048KB or 2MB
-
September 15, 2015 at 4:48 am #29758
See if this works for you:
-
AuthorPosts
The topic ‘Invoke-CimMethod ignoring MaxEnvelopeSizeKb’ is closed to new replies.