Extremely slow Powershell remote execution?

2019-05-23 02:26发布

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条回答
我只想做你的唯一
2楼-- · 2019-05-23 03:25

Please set the following Parameters for the WSManConnectionInfo:

connectionInfo.SkipRevocationCheck=true

connectionInfo.SkipCACheck=true

Then test again.

查看更多
登录 后发表回答