Question

I have setup lots of Powershell scripts on my WIndows 2008 R2 server. The scripts do lots of processing (data crunching, executing SQLCMD.exe, bcp.exe etc). All of these scripts work without issues.

I am trying to call and execute the scripts from a remote laptop (within the same network) using the following command:

Enter-PSSession -ComputerName sun -ConfigurationName myprofile

The "myprofile" currently has just one function that will change directory to c:

This allows me to execute the scripts from my local laptop, however, they "run" on the server. That is my understanding.

However, I have not seen any scripts execute fully. At random intervals, the scripts fail with the below error messages... Once again, I have never seen these errors when I am trying to run the scripts on the server itself.

Any inputs on how to "fix" these errors? Any settings that I need to do on the "client" in terms of memory allocation?

a.

Processing data for a remote command failed with the following error message: Not enough storage is available to complete this operation. For more information, see the about_Remote_Troubleshooting Help topic.

b.

Get-Content : Exception of type 'System.OutOfMemoryException' was thrown.
At E:\automation\mssql-upload.ps1:144 char:14
+     (get-content <<<<  $PipeFile -ReadCount 1000) | set-content $FinalFile
+ CategoryInfo          : InvalidOperation: (:) [Get-Content], OutOfMemoryException
+ FullyQualifiedErrorId : ProviderContentReadError,Microsoft.PowerShell.Commands.GetContentCommand

c.

[Microsoft] [ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV

d.

Processing data for a remote command failed with the following error message: The WSMan provider host process did not return a proper response.  A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic.
Était-ce utile?

La solution

It is likely your remote session is bumping up against the WS-Man quota MaxMemoryPerShellMB. You can see the current value by executing this command on the remote machine:

Get-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 

You can set a new value like so:

Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 512 -Force

This sets the value at 512MB. Set it to a value that works for your application.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top