1

There are several virtual machines in the group, and 2 of them have really bad performance running Powershell.

A simple script like powershell.exe -NonInteractive -NoProfile -Command "Write-Output $PSVersionTable.PSVersion" takes seconds on most of the machines, but 5+ minutes on 2 of them. Powershell version 3.0 btw.

As far as I can tell all the machines are configured the same. I've tried ngen the powershell binaries but that hasn't helped.

How do I figure out what's causing the poor powershell performance?

Cameron MacFarland
  • 111
  • 1
  • 1
  • 4
  • 3
    Download `procmon` from Sysinternals and monitor what is going on. Try to draw conclusions from there *(or post the trace for us to analyze)* – Lieven Keersmaekers Jan 03 '18 at 05:49

1 Answers1

1

I've seen something very similar to this myself. (I know it says slower in Server 2016 in the title, but we experienced it Windows 10 and other OS's too.)

Link to https://github.com/PowerShell/PowerShell/issues/3080e ..

It was resolved by running "winrm quickconfig" in PowerShell as noted in the article. It worked for me personally. I know the commands we're running are a little different, but it might we worth a try.

Runtime for the command went from 2+ minutes to ~1 second.

Cheers!

Eric O
  • 21
  • 1
  • Thanks! From looking over that issue, `winrm quickconfig` appears to enable "Windows Remote Management" service, which seems to speed up / fix certain powershell commands (like `Get-ComputerInfo`), but I don't think it improves powershell startup (which is what I was looking into when I came across this Q&A). – Nickolay Aug 26 '18 at 18:56