Why does Powershell take so long to init?
When I fire up powershell it takes ~10-15 seconds to init and give me a prompt. Anyone know what it's doing when you first fire it up that might contribute to that? This is XP Pro, 2 GB of memory, only Outlook and Firefox running interactively, fairly straight-up.
The Powershell team has a fix for this on their blog.
Content of the script from the site mentioned Update-gac.ps1
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$_"}
}
}
Do you have a flaky/missing internet connection?
Could depend on Windows Security trying to contact certificate authority to the get the certificate revoke list. If there is no internet connection, you'll have to wait for the timeout.
Edit:
You could try to debug this using Sysinternal's(/Microsoft's) Process Explorer. Maybe you can see which resources are accessed by the process.