Wednesday, February 10, 2010

The response that the WS-Management service computed exceed the internal limit for envelope size.

I have been hiding in PowerShell and WSMAN land for quite a few weeks now.  And each time I set up a new client machine or I scale out the number of VMs in my environment I run against this error:

Exception calling "Enumerate" with "1" argument(s): "The response that the WS-Management service computed exceed the internal limit
for envelope size. "

What am I doing?  Well, right now I am calling an enumerate class through WSMAN and listing all of the VMs that I have on a hypervisor.

Why do I get the error?  I know why, it is because the return string is so freaking large that the client side of WSMAN (the WinRM listener on my client PC where I am running the query from) says: “hey, my allocated buffer is full and you are trying to feed me ‘just one more wafer thin mint’”

Instead of exploding all over the place I get this nice, friendly warning.

How do I tweak my client to increase the receive envelope size?

Open an elevated command prompt (run as admin) and type:

winrm set winrm/config @{MaxEnvelopeSizekb="1024"}

Note = you do not need to set yours to 1024, I just set it higher than the default.

This was the last setting I had, but I need to go higher as I add more and more VMs.  One to 2Mb I go…