Gather specific subkey values or an entire registry key’s subkey values with powershell and multithreading.
I’ve become a bit enamored with a multithreaded function I found recently on the Internet. (After reading through a good portion of the Powershell Deep Dive book I’m almost certain the roots of that function are from the legendary Boe Prox). Using this function as a template I’ve released my own function which gathers several bits of system information from WMI using within runspaces. As gathering remote registry information is really just a wmi connection I modified this same script to gather anything from a remote system’s registry as well. This is the resulting function.
As always (in my general scripts at least), this function supports supplying or prompting for alternate credentials. The default examples included in the comment based help show a very nice use case scenario for such a multithreaded powershell function, gathering remote time server information from a server. If you had to do this for 800 servers then this might be very handy indeed.
Many times you may need more than just one subkey value from a remote registry so instead of adding additional connections and processing I included the ability to just skip the subkey altogether and return all of the subkey values found under the key instead.