Skip to content

Mixing -Parallel, dot sourcing and $using: dont work. Please, explain #21348

Answered by jborean93
vcudachi asked this question in Q&A
Discussion options

You must be logged in to vote

The variables for $using: must be provided as arguments to the code that is running. PowerShell achieves this by scanning the AST of the scriptblock provided to -Parallel and finds any $using: statements. In your example the $using: statement is inside a separate script which is invoked when the block is run rather than being included at parse time so PowerShell has no way of knowing about it when parsing the original scriptblock to run.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vcudachi
Comment options

Answer selected by vcudachi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants