{"id":24629510,"url":"https://github.com/sharpjs/psconcurrent","last_synced_at":"2026-05-06T04:33:08.268Z","repository":{"id":68402947,"uuid":"114127270","full_name":"sharpjs/PSConcurrent","owner":"sharpjs","description":"PowerShell Invoke-Concurrent Cmdlet","archived":false,"fork":false,"pushed_at":"2019-10-30T17:33:17.000Z","size":228,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T04:40:05.695Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharpjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-13T13:56:59.000Z","updated_at":"2024-05-30T17:05:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"e08c4e97-3555-4cb6-8be5-c52d2c443339","html_url":"https://github.com/sharpjs/PSConcurrent","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sharpjs/PSConcurrent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FPSConcurrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FPSConcurrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FPSConcurrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FPSConcurrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharpjs","download_url":"https://codeload.github.com/sharpjs/PSConcurrent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FPSConcurrent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32678626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T02:33:58.958Z","status":"ssl_error","status_checked_at":"2026-05-06T02:33:39.611Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-25T06:13:10.161Z","updated_at":"2026-05-06T04:33:08.256Z","avatar_url":"https://github.com/sharpjs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PSConcurrent\n\nAn `Invoke-Concurrent` cmdlet for PowerShell.\n\nAvailable in the [PowerShell Gallery](https://www.powershellgallery.com/packages/PSConcurrent).\n\n## Status\n\n**PSConcurrent 1.x** has been used in production for several years.  There have\nbeen no bug reports.\n\n**PSConcurrent 2.x** is new but does not make significant cmdlet changes.\nRather, the update adds PowerShell Core support and 100% test coverage.\n\nWhile the author strives to create bug-free software, PSConcurrent is provided\n**as is** and without warranty of any kind.  For details, see the\n[license and disclaimers](https://github.com/sharpjs/PSConcurrent/blob/master/LICENSE.txt).\n\n## Requirements\n\nPSConcurrent works with both PowerShell Core and traditional Windows PowerShell,\nnow known as PowerShell Desktop Edition.\n\nFor **PowerShell Core**:\n* PowerShell Core 6.0 or later.\n\nFor **PowerShell Desktop**:\n* PowerShell 5.1 or later.\n* .NET Framework 4.6.1 or later.\n* [PowerShellGet](https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-5.1)\n\n## Installation\n\nTo install PSConcurrent, run this command:\n```powershell\nInstall-Module -Name PSConcurrent\n```\nThen restart PowerShell.\n\n## Updating\n\nTo update PSConcurrent, run this command:\n```powershell\nUpdate-Module -Name PSConcurrent\n```\nThen restart PowerShell.\n\n## Usage\n\n### Basics\n\nAt its most basic, Invoke-Concurrent runs a set of script blocks ... well,\nconcurrently.\n\n```powershell\nInvoke-Concurrent {echo a}, {echo b}, {echo c}\n```\n```\n[Task 1]: Starting\n[Task 2]: Starting\n[Task 3]: Starting\n[Task 2]: Ended\n[Task 1]: Ended\n[Task 3]: Ended\n\nTaskId Object\n------ ------\n     2 b\n     1 a\n     3 c\n```\n\nYou can also pipe the script blocks to Invoke-Concurrent:\n\n```powershell\n{echo a}, {echo b}, {echo c} | Invoke-Concurrent\n```\n\nWhen a script block writes content to the error, warning, information, verbose,\nor debug streams, or directly to the host, Invoke-Concurrent writes the content,\nbut adds text to identify which \"task\" (script block) sent it.  When a script\nblock writes an object to the output stream, Invoke-Concurrent wraps the object\nin a container whose `TaskId` property identifies the task that sent the object.\nTask ids start at 1.\n\n### Controlling Concurrency\n\nThe script blocks run simultaneously at a level of concurrency determined by the\n[.NET managed thread pool](https://docs.microsoft.com/en-us/dotnet/standard/threading/the-managed-thread-pool)\n— usually, the number of virtual processors in the system.  You can provide an\nexplicit limit on the number of concurrently-running script blocks with the\n`-MaxConcurrency` parameter.\n\n```powershell\nInvoke-Concurrent {echo a}, {echo b}, {echo c} -MaxConcurrency 2\n```\n```\n[Task 1]: Starting\n[Task 2]: Starting\n[Task 1]: Ended\n[Task 3]: Starting\n[Task 2]: Ended\n[Task 3]: Ended\n\nTaskId Object\n------ ------\n     1 a\n     2 b\n     3 c\n```\n\n### Variables and Modules\n\nBy default, script blocks do not see variables and modules from the PowerShell\nsession that runs Invoke-Concurrent.  To change that, you can export specific\nvariables and modules with the `-Variable` and `-Module` parameters.\n\n```powershell\n$A = \"Hocus\"\n$B = \"pocus\"\nImport-Module PSMagic\n\nInvoke-Concurrent { Write-Host \"$A $B\" }, { Use-MagicWand } `\n    -Variable (Get-Variable A, B) `\n    -Module   (Get-Module PSMagic)\n```\n```\n[Task 1]: Starting\n[Task 2]: Starting\n[Task 1]: Hocus pocus\n[Task 1]: Ended\n[Task 2]: Ended\n\nTaskId Object\n------ ------\n     2 PSMagic.Models.WandResult\n```\n\nTo export different variables and modules per script block, you can pipe parameters-as-objects to Invoke-Concurrent.\n\n```powershell\n$A = \"Hocus\"\n$B = \"pocus\"\nImport-Module PSMagic\n\n$Tasks = `\n    [PSCustomObject] @{\n        ScriptBlock = { Write-Host \"$A $B\" }    # arrays allowed\n        Variable    = Get-Variable A, B         # arrays allowed\n    },\n    [PSCustomObject] @{\n        ScriptBlock = { Use-MagicWand }         # arrays allowed\n        Module      = Get-Module PSMagic        # arrays allowed\n    }\n\n$Tasks | Invoke-Concurrent\n```\n```\n[Task 1]: Starting\n[Task 2]: Starting\n[Task 1]: Hocus pocus\n[Task 1]: Ended\n[Task 2]: Ended\n\nTaskId Object\n------ ------\n     2 PSMagic.Models.WandResult\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpjs%2Fpsconcurrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharpjs%2Fpsconcurrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpjs%2Fpsconcurrent/lists"}