Making the PowerShell prompt startup faster!

I don’t know about you, but I like the actions I perform on a computer to be fluent… so whenever I start a PowerShell prompt I have to wait a few seconds before it’s loaded.
Now this is not a problem, just a little annoying and something I’ve always experienced but never taken the time to investigate if this could be made faster.

So, I’ve just stumbled upon an older blog post of Jeffrey Snover named “Speeding Up PowerShell Startup – Updating Update-Gac.ps1”.

Ask you can see, this post is back from September 2008 so I was wondering if this would still be accurate on a Windows 8 device with PowerShell v3… and it is!

After applying the script, starting the PowerShell prompt was blazing fast!

Set-Alias ngen (Join-Path ([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) ngen.exe)
[AppDomain]::CurrentDomain.GetAssemblies() |
sort {Split-path $_.location -leaf} |
$Name = (Split-Path $_.location -leaf)
if ([System.Runtime.InteropServices.RuntimeEnvironment]::FromGlobalAccessCache($_))
Write-Host "Already GACed: $Name"
Write-Host -ForegroundColor Yellow "NGENing : $Name"
ngen $_.location | %{"`t$_"}


  1. Thanks for the reminder on this.  Before running this my profile ran in 00:00:00.3990228. Afterwards it ran 00:00:00.0500029

  2. Lee Holmes says:

    Which assemblies were not NGENd? And which build is this?

    Lee Holmes [MSFT]

  3. Jeff Wouters says:

    Hi Lee,
    Built 8250, closed the prompt before I saw your message so don’t have a clue which assemblies were not NGENd… sorry.

Leave a Reply

Your email address will not be published. Required fields are marked *