proxb / PoshRSJob

Provides an alternative to PSjobs with greater performance and less overhead to run commands in the background, freeing up the console and allowing throttling on the jobs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shared dynamic variables in pre-execution function

tyteen4a03 opened this issue · comments

I'm setting up a mini-framework for a general task runner in which the tasks can define shared variables in a pre-execution function (Setup); the variables defined within will be available to all tasks invoked by Start-RSJob. I have no control over what variables will be set up in the Setup function, but all of them will need to be available in the jobs.

(If it helps, the variables will be read-only.)

What's the best way to do this with RS Jobs?

I think it is Synchronized hash
you can search for examples at Boe's website (or inside module :)

I ended up creating a $globals variable and stuffing everything I need into the variable. I was looking for something that's closer to $Using but my solution works well for me.