Search code examples
powershellbackgroundstart-job

Powershell Start-Job won't run


I'm trying to run a simple job process in powershell 2.0 and it doesn't seem to run.

    $job = Start-Job { Return "Some string." }

When I call $job, the status says it's running. But the problem is that it never completes.

Tried the same thing on my Windows 7 machine and it completes immediately.

I'm running powershell 2.0 on windows xp.

Does anyone know what is causing this problem? How can I fix this problem?

This is my $PSVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      2.0
    PSCompatibleVersions           {1.0, 2.0}
    BuildVersion                   6.0.6002.18111
    PSRemotingProtocolVersion      2.1
    WSManStackVersion              2.0
    CLRVersion                     4.0.30319.1
    SerializationVersion           1.1.0.1

Solution

  • I'd say your XP configuration of PowerShell is "somewhat" modified. :-) It should be running on CLR version 2.0 e.g.:

    Name                           Value
    ----                           -----
    CLRVersion                     2.0.50727.3615
    BuildVersion                   6.0.6002.18111
    PSVersion                      2.0
    WSManStackVersion              2.0
    PSCompatibleVersions           {1.0, 2.0}
    SerializationVersion           1.1.0.1
    PSRemotingProtocolVersion      2.1
    

    Try resetting the reg hack (or the Powershell.exe.config mod) so that PowerShell 2.0 is running on .NET 2.0 and see if the problem still exists.