maximum data size in a remote command

Question:

my powershell script sends a file to several clients within customised session using following code (code is shortened)

The full copy function is described here: http://poshcode.org/2216

The problem arises with a file larger than 52MB. it fails with following error:

As you see in the code, i use customised ps session. when i set MaximumReceivedDataSizePerCommand to very low values (like 10kb) it fails with a message which tells maximum is 10kb, so i assume that MaximumReceivedDataSizePerCommand is applied to ps session object.

Is it required to do this configuration on remote machine or somewhere else? what is causing this error?

thanks.

Answer:

You need to create a new PSSessionConfiguration (this to not use the default one) in your remote computer:

Then configuring the parameter you want (in this case MaximumReceivedDataSizePerCommandMB and MaximumReceivedObjectSizeMB):

Then create the new session with the PSSessionConfiguration you need:

in your local Computer.

In this way using the Send-File from posh.org I copy a file of ~80MB size.
Bigger size return me outofmemory exception.

More on this here.

Source:

maximum data size in a remote command by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply