Andy Levy shows how to use the PoshRSJob
module to implement multithreaded Powershell solutions:
Let’s say you’ve got a lot of RSJobs. Or maybe long-running RSJobs. Wouldn’t a nice, user-friendly view of the progress be handy? You bet it would!
This is both dense and verbose, but I wrote it really quickly and it works (but not just for this post, I’ve used it in production), so I’m not tinkering too much with it right now. Once the jobs are created (and a few have started), this script runs a loop watching the output ofGet-RSJob
and updates a progress bar to reflect where we are. It also takes care of receiving and removing the completed jobs.
This is pretty easy to work with—or at least Andy makes it look that way.