Extremely slow Powershell remote execution?

左心房为你撑大大i 提交于 2019-12-22 12:31:21

问题


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.

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.)

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?

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.

Example commands:

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

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

回答1:


Please set the following Parameters for the WSManConnectionInfo:

connectionInfo.SkipRevocationCheck=true

connectionInfo.SkipCACheck=true

Then test again.



来源:https://stackoverflow.com/questions/25897950/extremely-slow-powershell-remote-execution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!