如何让 7za.exe 通过 Powershell Remoting 运行? [英] How can I get 7za.exe to run via Powershell Remoting?

查看:36
本文介绍了如何让 7za.exe 通过 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:ScriptsArchiveEventLogsver4.57za.exe" -ArgumentList "a", 
    "C:ScriptsEventlogs.bakServerA-20101111.7z", "C:ScriptsEventlogs.bak*.evt*", 
     "-mx7", "-oC:ScriptsEventlogs.bak", "-wC:ScriptsEventlogs.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:ScriptsEventlogs.bakServerA-20101111.7z

ERROR: Can't allocate required memory!

我怎样才能克服那个错误???

How can I get past that error???

我应该指出,如果我在没有远程处理的情况下直接在 ServerA 上运行 Scriptblock,它可以工作.感谢您的帮助!

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:Windowssystem32>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.

这篇关于如何让 7za.exe 通过 Powershell Remoting 运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆