invoke Multiple powershell instances through PowerISE RRS feed

  • Question

  • I have multiple csvs in a folder that are name sequentially (e.g. 1 to 100). How is it possible to invoke multiple powershell child instances through PowerISE. Each of those child instances will read a corresponding csv and process it further. (e.g. instance 1 will invoke 1.csv likewise).

    Any way to achieve this?

    • Edited by wiki_vk Monday, April 8, 2019 8:14 AM
    Sunday, April 7, 2019 7:55 AM

All replies

  • We do not deliver ready to use code on request. You will have to write it yourself.

    To make your life easier you should take a look at a module helping you dealing with runspaces in Powershell - PoshRSJob. You might watch the video from the maker of that module as well to get the idea ... Video: The Art of PowerShell Runspaces.

    Live long and prosper!


    Sunday, April 7, 2019 8:52 AM
  • No one would ever have a reason to do what you ask.  What you want to do is start multiple  PowerShell jobs or use a workflow.

    PowerShelISe is not an execution environment and cannot be used the way you ask.  It cannot automatically execute a script.  It is only a script editor and test environment.

    Before asking any question about PowerShell in this or any technical forum you will have to first learn basic PowerShell.

    Here is a good place to start: Microsoft Virtual   Academy - Getting Started with Microsoft PowerShell

    This will help you to understand why your question is a problem and how to use PowerShell to run jobs and script a workflow.


    Sunday, April 7, 2019 10:16 AM
  • Here is a basic example to help you get started:

    Get-ChildItem *.csv |
            [array]$jobs += Start-Job -ScriptBlock {<code to execute>} -ArgumentList $_

    Do the tutorial to understand what this is and how it can be used.


    Sunday, April 7, 2019 10:19 AM
  • Here is a simple example of a workflow.

    Workflow ProcessCsvFiles{
        $files = Get-ChildItem *.csv
        foreach -parallel ($file in $files){
            # < proess the csv file >


    Sunday, April 7, 2019 10:35 AM