Skip to content

about_Jobs, Start-Job, and Start-ThreadJob should mention the $using scope and link to about_Remote_Variables #5069

@mklement0

Description

@mklement0

In order to directly use variable values from the caller's scope in a job script block, you must use the $using: scope (as a more convenient alternative to passing arguments).

This fact should be mentioned in these topics, and they should link to about_Remote_Variables for further information.

Note that special considerations apply to Start-ThreadJob with $using: references whose values are instances of reference types, because the same object can potentially be modified my multiple thread jobs in a non-thread-safe way; this is more likely to occur with ForEach-Object -Parallel - where it is already documented, but it's worth mentioning in the Start-ThreadJob topic too.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageArea - PowerShell syntax and keywords

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions