20

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.

15

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$_"}
         }
      }
1
  • 1
    I ran the Update-Gac.ps1 script which didn't do anything, but noticed they mention on the post that it's a v1 bug and is fixed in v2. I installed v2 CPT3 which fires up in 1-2 seconds. Works for me, thanks!
    – squillman
    May 13 '09 at 14:50
1

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.

1
  • Nope. I have check for revoke lists off anyway...
    – squillman
    May 13 '09 at 14:14
0

How long does it take to immediately start up another instance?

If much quicker, then you are seeing the time it takes to load .NET, PSH and Snapins. If not, then likely to be profile related (either PSH profile or something like contacting AD1).

1 I've see this with PSCX's AD provider when working remotely.

2
  • Good thoughts! But same amount of time...
    – squillman
    May 13 '09 at 14:24
  • We've disabled the automatic creation of an AD drive now in Pscx 1.2 (now in public beta! pscx.codeplex.com)
    – x0n
    May 14 '09 at 17:44
0

Your $profile can be extremely long, so check it.

2
  • 1
    dude, this question was originally asked over eleven years ago :-)
    – LeeM
    Sep 25 '20 at 6:37
  • Heh, yeah. Good thought, but didn't even have a profile set up at the time. Maybe someone else will run into this though!
    – squillman
    Sep 25 '20 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.