如何通过Powershell Remoting运行7za.exe? [英] How can I get 7za.exe to run via Powershell Remoting?
问题描述
我尝试了多种不同的方法来执行此操作,它们均导致相同的错误。
这是一组命令:
I've tried a number of different ways to do this, they all result in the same error. Here is one set of commands:
$s = New-PSsession -ComputerName ServerA
$job = Invoke-Command -Session $s -Scriptblock { Start-Process -FilePath
"C:\Scripts\ArchiveEventLogs\ver4.5\7za.exe" -ArgumentList "a",
"C:\Scripts\Eventlogs.bak\ServerA-20101111.7z", "C:\Scripts\Eventlogs.bak\*.evt*",
"-mx7", "-oC:\Scripts\Eventlogs.bak", "-wC:\Scripts\Eventlogs.bak", "-t7z" -Wait }
-AsJob
Get-Job | Wait-Job
Receive-Job Job$
我得到的输出是这样的:
The output I get is this:
7-Zip (A) 9.17 beta Copyright (c) 1999-2010 Igor Pavlov 2010-10-04
Scanning
Creating archive C:\Scripts\Eventlogs.bak\ServerA-20101111.7z
ERROR: Can't allocate required memory!
如何克服该错误????
How can I get past that error???
我应该指出,如果我直接在ServerA上运行脚本块而不进行远程处理,那么它将起作用。
感谢您的帮助!
I should point out, if I run the Scriptblock directly on ServerA without the remoting, it works. Thanks for any help!
推荐答案
默认情况下,远程shell的内存限制为150 MB。您可以使用服务器上的winrm命令行实用程序进行调整。我不确定powershell wsman:\驱动器是否可以让您交互式地更改此设置,因为我认为这是winrm中shell插件功能的一般属性,而不是直接连接到powershell。
Remote shells are limited to 150 MB of memory by default. You can tweak this with the winrm command-line utility on the server; I'm not sure if the powershell wsman:\ drive will let you change this interactively because I think it's a general property of the shell plugin functionality in winrm and not directly connected to powershell.
C:\Windows\system32>winrm get winrm/config/winrs
Winrs
AllowRemoteShellAccess = true
IdleTimeout = 180000
MaxConcurrentUsers = 5
MaxShellRunTime = 2147483647
MaxProcessesPerShell = 15
**MaxMemoryPerShellMB = 150**
MaxShellsPerUser = 5
压缩大文件是一个需要大量内存的过程。
Compressing large files is a memory-hungry process.
这篇关于如何通过Powershell Remoting运行7za.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!