Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4027724
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:07:56+00:00 2026-05-20T11:07:56+00:00

I want to run 15 instances of a script that pipelines 5 scripts together,

  • 0

I want to run 15 instances of a script that pipelines 5 scripts together, and so far I’m missing the pixie dust. I’ve boiled the problem down to a test case with a master script that calls a slave script that in turn calls a sub_slave script (no pipelines are necessary to reproduce the failure.)

If master.ps1 calls slave.ps1 each background job hangs indefinitely at the point slave.ps1 calls to sub_slave.ps1. If I comment out the call in slave.ps1 to sub_slave.ps1, master.ps1 runs to completion. And if I start slave.ps1 directly, it runs the call to sub_slave.ps1 just fine. The problem seems intractable, though if I try the double-chain. I’ve not seen anything in the docs saying you cannot daisy chain these scripts past some arbitrary depth, but maybe I’m not reading deeply enough?

You’ll see I’m tracking progress through the script by add-content to a simple text file.

d:\jobs\master.ps1

$indexes = @(0,1,2)

$initString = "cd $pwd"
$initCmd = [scriptblock]::create($initString)

set-content -path out.txt -value "Master started"
foreach ($index in $indexes)
{
    add-content -path out.txt -value "job  starting"
    start-job -filepath slave.ps1 -InitializationScript $initCmd -ArgumentList @("master index $index originated")
}

add-content -path out.txt -value "master completed"

d:\jobs\slave.ps1

#requires -version 2.0

param (
    [parameter(Mandatory=$false)]
    [string]$message = "slave_originated"
)

begin
{
    Set-StrictMode -version Latest
    add-content -path out.txt -value "slave beginning in $pwd"
}

process
{
    add-content -path out.txt -value "slave processing $message"
    invoke-expression "D:\jobs\sub_slave.ps1 -message $message" 
}

end
{
    add-content -path out.txt -value "slave ending"
}

d:\jobs\sub_slave.ps1
#requires -version 2.0

param (
    [parameter(Mandatory=$false)]
    [string]$message = "sub_slave originated"
)

begin
{
    Set-StrictMode -version Latest

    add-content -path out.txt -value "sub_slave beginning"
}

process
{
    add-content -path out.txt -value "sub_slave processing $message"
}

end
{
    add-content -path out.txt -value "sub_slave ending"
}

When the code is run as written, without anything commented out, I get this in out.txt:
d:\jobs\out.txt

Master started
job  starting
job  starting
job  starting
master completed
slave beginning in D:\jobs
slave processing master index 0 originated
slave beginning in D:\jobs
slave processing master index 1 originated
slave beginning in D:\jobs
slave processing master index 2 originated

Note that the very next command after each farewell message is the call to sub_slave.ps1 and that no message from sub_slave.ps1 appears at all. The system will hang with 3 powershell.exe processes running happily forever. Get-job reports the 3 processes are still Running and HasMoreData.

The only clue I’ve got is that if I crash dump the hung processes, I see:

Number of exceptions of this type:        2
Exception MethodTable: 79330e98
Exception object: 012610fc
Exception type: System.Threading.ThreadAbortException
Message: <none>
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 80131530
-----------------

Number of exceptions of this type:        2
Exception MethodTable: 20868118
Exception object: 01870344
Exception type: System.Management.Automation.ParameterBindingException
Message: System error.
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 80131501
-----------------

Perhaps I’m having some sort of parameter issue? If I remove all parameters from sub_slave.ps1 the behaviour is unchanged, so I kind of doubt that, but it’s possible. I’m open to any idea.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:07:56+00:00Added an answer on May 20, 2026 at 11:07 am

    You are calling sub_slave.ps1 wrong. This:

    invoke-expression "D:\jobs\sub_slave.ps1 -message $message" 
    

    Should be this:

    D:\jobs\sub_slave.ps1 -message $message
    

    The message was getting evaluated and became multiple arguments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run a cron job every minute that will launch a script.
I want a sed script that I can use for 1) finding instances, and
I want to run multiple instances of apache on one single machine? How to
I want run a script as follows: runner: ssh 'java program &' ssh 'java
I want to run a script remotely. But the system doesn't recognize the path.
I'm using mongoose in a script that is not meant to run continuously, and
I have a script that I use to connect to localhost:8080 to run some
So I have this nice slider script that I want to use on this
Why this code don't work,when i want run this code vwd 2008 express show
I want to run a process in bash and save in an env variable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.