Windows – Powershell slow starting on Windows 10

performancepowershellwindows 10

I have problem with slow starting of powershell prompt on Windows 10 ( Version 1703 – Creators Update ).

My hw specs ( quite fast machine ): Intel i5-7440HQ (Quad Core) / 32GB DDR4 RAM / 512 Samsung SSD hard drive.

I tried to bypass profile and execution policy but it does not change anything:

powershell -noprofile -ExecutionPolicy Bypass ( Measure-Command { powershell "Write-Host 1" } ).TotalSeconds

6,228067

My friends same laptop with Windows 10 without Creators Update runs powershell in less than 0,5 sec.

Also tried do some compilation with ngen.exe but it didn't help:

$env:path = [Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
[AppDomain]::CurrentDomain.GetAssemblies() | % {
  if (! $_.location) {continue}
  $Name = Split-Path $_.location -leaf
  Write-Host -ForegroundColor Yellow "NGENing : $Name"
  ngen install $_.location | % {"`t$_"}
}

Any idea how may I investigate this issue?

Greetings

Best Answer

This was happening to me also - though maybe not the best route, adding powershell.exe to the list of Windows Defender exclusions sped it up from 20 seconds to < 1 second.

Using legacy console, purging PSReadLine, and running ngen did not seem to help at all.

Related Question