为什么Powershell需要这么长时间才能启动?

当我启动powershell需要约10-15秒,初始化并给我一个提示。 当你第一次启动它时,任何人都知道它在做什么,这可能有助于那个? 这是XP专业版,2 GB的内存,只有Outlook和Firefox交互式运行,相当直接。

Powershell团队已经在他们的博客上修正了这个问题 。

脚本的内容提到了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$_"} } } 

你有一个片状/缺less互联网连接?

可能依靠Windows安全性尝试联系证书颁发机构以获取证书吊销列表。 如果没有互联网连接,你将不得不等待超时。

编辑:

你可以尝试使用Sysinternal的(/微软的)Process Explorer进行debugging。 也许你可以看到进程访问哪些资源。

需要多久才能立即启动另一个实例?

如果更快,那么你看到加载.NET,PSH和Snapins的时间。 如果不是,那么可能是与configuration文件相关的(PSHconfiguration文件或类似联系AD 1 )。

1在远程工作时,我已经看到PSCX的AD提供程序。