Created
March 15, 2015 12:54
-
-
Save avin/532050e0937becc25fd4 to your computer and use it in GitHub Desktop.
Speeding Up PowerShell Startup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
}else | |
{ | |
Write-Host -ForegroundColor Yellow "NGENing : $Name" | |
ngen $_.location | %{"`t$_"} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment