Working in a big Enterprise is a whole different animal than small business (which has been my space for a long time). I’m finding myself doing a lot more multi-threading because of the pure scale of things that need to be done and running a single threaded sequence just takes too long. But that doesn’t mean I don’t want to give my users feedback about the progress of my scripts, in fact, the larger the work load the more important feedback becomes. I recently discovered a technique that allows me to do just that–but not before putting my own spin on it.
In your scripting journey there will come a time that you have a script that is simply running too long. Perhaps you’re wanting to gather information hourly and the script is taking two hours to run. Maybe you’re a consultant and need a discovery script to run as fast as possible so you can get out of there? Whatever it is at some point you’ll consider multithreading. Powershell has this capability baked right into it using Powershell Jobs, but .Net has a way too, and initial testing shows it might be faster! Read on to see what I mean.