Invoke-CimMethod ignoring MaxEnvelopeSizeKb

Welcome Forums General PowerShell Q&A Invoke-CimMethod ignoring MaxEnvelopeSizeKb

This topic contains 3 replies, has 2 voices, and was last updated by

 
Participant
3 years, 5 months ago.

  • Author
    Posts
  • #29721

    Participant
    Points: 0
    Rank: Member

    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.

  • #29733

    Participant
    Points: 503
    Helping Hand
    Rank: Major Contributor

    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.

  • #29738

    Participant
    Points: 0
    Rank: Member

    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

  • #29758

    Participant
    Points: 503
    Helping Hand
    Rank: Major Contributor

    See if this works for you:

    CIM error

The topic ‘Invoke-CimMethod ignoring MaxEnvelopeSizeKb’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort