Skip to content

Instantly share code, notes, and snippets.

@StartAutomating
Created January 26, 2025 21:22
Show Gist options
  • Save StartAutomating/b71376cfcad48e271ba19410ab650381 to your computer and use it in GitHub Desktop.
Save StartAutomating/b71376cfcad48e271ba19410ab650381 to your computer and use it in GitHub Desktop.
Gist showing how to declare functions in a background job
Start-ThreadJob {param($V)
foreach ($kv in $v.GetEnumerator()) {
$ExecutionContext.SessionState.PSVariable.Set($kv.Key, $kv.Value)
}
testing
} -Arg @{'function:testing' = {1..3}} | Wait-Job | Receive-Job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment