Script

CIM error

I was trying get some hardware info via CIM, the other day and ran into this error message:

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

At line:4 char:12
+ $Logical = Get-CimInstance -CimSession $Session -ClassName CIM_EnabledLogicalEle ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : LimitsExceeded: (root\cimv2:CIM_EnabledLogicalElement:String) [Get-CimInstance], CimExce
ption
+ FullyQualifiedErrorId : HRESULT 0x80338049,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand
+ PSComputerName : hostname

After googling the error i found a lot of site pointing to this command –

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

 

which needs to be run as admin. Only problem it doesn’t work on windows 7/2008+… As it turns out, it was for windows xp/2003 – So I starting looking for the same command for windows 7/2008+ and guess what I found one. Once again this needs to be run as admin in powershell this size can be changed as needed on some HP G7 blade 1024 was enough, but when I tried to do the same command on a G8 blade it once again failed with the above error message, so I had to increase the size once more. Well you need to find your own setting, but the below is a good starting point.

Solution:

Set-Item WSMan:\localhost\MaxEnvelopeSizekb 1024

 

One thought on “CIM error

Leave a Reply

Your email address will not be published. Required fields are marked *