我在我的WIndows 2008 R2服务器上设置了许多Powershell脚本。脚本执行大量处理(数据处理,执行SQLCMD.exe,bcp.exe等)。所有这些脚本都可以正常运行。
我正在尝试使用以下命令从远程笔记本电脑(在同一网络中)调用和执行脚本:
Enter-PSSession -ComputerName sun -ConfigurationName myprofile
“myprofile”目前只有一个将目录更改为c:
的功能这允许我从本地笔记本电脑执行脚本,但是,它们在服务器上“运行”。这是我的理解。
但是,我还没有看到任何脚本完全执行。随机间隔,脚本失败并显示以下错误消息...再一次,当我尝试在服务器上运行脚本时,我从未见过这些错误。
有关如何“修复”这些错误的任何输入?在内存分配方面我需要在“客户端”上进行的任何设置?
一个。
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.
湾
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
下进行。
[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.
答案 0 :(得分:4)
您的远程会话很可能与WS-Man配额MaxMemoryPerShellMB
相冲突。您可以通过在远程计算机上执行此命令来查看当前值:
Get-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB
您可以像这样设置一个新值:
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 512 -Force
这将值设置为512MB。将其设置为适合您的应用程序的值。