简体   繁体   English

cmd文件的远程执行(PowerShell)未完成

[英]remote execution(PowerShell) of cmd file doesn't complete

Current PS script: 当前的PS脚本:

Invoke-Command -ComputerName RemoteServer007.FQDN.com -ScriptBlock { 
    Set-Variable -Name WOWCONFIG -value "d:\ABCs\WOWzers" `
    | Start-Process "d:\da-folder\Do-It-NOW-Pleez.cmd" 
}

If I log on locally to the server(RemoteServer007.FQDN.com) and execute the cmd file, it runs through all of the lines(commands) within the cmd file. 如果我本地登录到服务器(RemoteServer007.FQDN.com)并执行该cmd文件,则它将运行该cmd文件中的所有行(命令)。

When I execute it remotely, it gets about 30% of the way through the commands within the cmd file, the PS execution ends without error, but not all of the lines/commands in the cmd file had been executed. 当我远程执行它时,它将通过cmd文件中的命令完成大约30%的操作,PS执行无错误结束,但不是cmd文件中的所有行/命令都已执行。

This was discovered by simply configuring each line of the cmd file to output to txt files. 这是通过简单配置cmd文件的每一行以输出到txt文件而发现的。 I even tried re-ranging the commands in the cmd file, thinking that perhaps there was a specific command that was causing it to exit, but that is not the case. 我什至尝试重新调整cmd文件中的命令范围,以为可能是某个特定的命令导致该命令退出,但是事实并非如此。

I'm wondering if there is some timeout or response that PowerShell is not getting? 我想知道PowerShell是否没有超时或响应? and just quitting almost immediately after starting? 并在开始后几乎立即退出?

Any ideas or help would be greatly appreciated. 任何想法或帮助将不胜感激。

There are a couple of things you can do here: 您可以在这里做几件事:

  • You may have a memory issue. 您可能有内存问题。 Increasing the value of MaxMemoryPerShellMB might help 增加MaxMemoryPerShellMB的值可能会有所帮助

    set-item WSMan:\\$target\\Shell\\MaxMemoryPerShellMB -Value 0 -Force 设置项目WSMan:\\ $ target \\ Shell \\ MaxMemoryPerShellMB-值0-强制

You'd need to run this once on the remote machine before you execute your commands again. 您需要在远程计算机上运行一次,然后再次执行命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM