WinRM can be a very useful tool (even if it is somewhat of a challenge to set-up [esp if you want to use CredSSP]. I am however finding it more and more useful to execute cmdlets for Powershell modules you cant easily install; An example is the Operations Manager 2012 cmdlets that are only installed with the Console.
For a maintance mode script we recently used (similar to this one) I found myself tripping over one of the following errors when attempting to remotely connect to my SCOM server and put a group into maintenance mode:
Processing data from remote server failed with the following error message: TheWSMan Providor host did not return a proper response. A Providor in the host process may have behaved improperly. For more information, see the about help _Remoting_troubleshooting help topic.
Or
Processing data for a remote command failed with the following error message: Deserialized objects exceed the memory quota. For more information, see
the about_Remote_Troubleshooting Help topic
These messages are nice and generic with no real hint to the cause. So why does it happen?
When attempting to run up the OperationsManager Module (and subsequantly connect to the SCOM SDK) to run cmdlets we will exhaust the 150MB defualt WSMan memory allocation. In order to continue we will need to exend the “MaxMemoryPerShellMb” allocation Run the following to view/alter these values:
#View Existing WSMan MaxMemory Value Get-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB #Set new WSMan MaxMemory Value to 1 Gb Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024 -Force
Easy 🙂
-Patrick
Nice one – thanks very much for the tip!
-Nick
I run this on the agent where i’m running the script, or I run it on the scom server where i’m invoking commands?
Hi Curtiss – Run it on the SCOM Server that’s invoking the commands 🙂
jxson8