Powershell远程执行速度极慢? [英] Extremely slow Powershell remote execution?

查看:136
本文介绍了Powershell远程执行速度极慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以加快 powershell 远程处理的速度?现在,要在我的 VM 上执行远程"命令,只需使用带凭据的 Invoke-Command 执行一个简单的 hello world 大约需要 30-90 秒.

Is there any way to speed up powershell remoting? Right now, to execute a "remote" command on my VM, it takes about 30-90 seconds just do do a simple hello world using Invoke-Command with credentials.

如果我在初始执行后立即运行命令,则不会有任何延迟.但是,如果我等待 3-4 分钟,我会再次看到延迟大幅飙升(30-90 秒).我也尝试过使用 Enter-PSSession 并且发生了同样的事情(对于初始命令,它很慢,然后很快,直到我在 3-4 分钟内没有发出命令,此时它再次变慢为爬行.)

If I run commands right after that initial execution, I don't get any delay. However, if I wait 3-4 minutes I see a big spike in delay again (30-90 seconds). I've also tried using Enter-PSSession and the same thing happens (for the initial command it's slow, then fast, until I don't issue commands for 3-4 minutes, at which point it slows to a crawl again.)

我尝试过使用会话(并配置 PsSession-Options http://technet.microsoft.com/en-us/library/hh849703.aspx)但它们似乎也空闲"了,而且首先创建会话仍然需要 30-90 秒.我没有运气就禁用了防火墙和 Windows Defender.关于如何获得更好性能的任何想法?

I've tried using sessions (and configuring PsSession-Options http://technet.microsoft.com/en-us/library/hh849703.aspx) but they seem to "idle out" as well, and it still takes 30-90 seconds to create a session in the first place. I've disabled the firewall and Windows Defender with no luck. Any ideas on how to get better performance?

安装是干净的 Windows,在 VM 上运行 powershell 4.0.我的主机已加入域,但 VM 未加入.非常感谢您的帮助,我已经被这个问题困扰了一段时间.

The install is clean windows, running powershell 4.0 on a VM. My host machine is domain joined, but the VM is not. Help is much appreciated, I've been frustrated by this problem for a while now.

示例命令:

Invoke-Command { $env:computername; } -Session $session

Invoke-Command { $env:computername; } -Credential $cred

推荐答案

请为 WSManConnectionInfo 设置以下参数:

Please set the following Parameters for the WSManConnectionInfo:

connectionInfo.SkipRevocationCheck=true

connectionInfo.SkipRevocationCheck=true

connectionInfo.SkipCACheck=true

connectionInfo.SkipCACheck=true

然后再次测试.

这篇关于Powershell远程执行速度极慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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