Kansa Core: Consider using PSRunspaces over PSSessions
jt-msft opened this issue · 1 comments
Boe Prox has some sample code and a few blog posts about PSRunspaces that make them seem like a much more performant option for multithreading collection activities.
http://learn-powershell.net/2012/05/10/speedy-network-information-query-using-powershell/
http://learn-powershell.net/2014/06/11/norcal-powershell-user-group-presentation-on-runspaces-is-available/
https://github.com/proxb/PoshRSJob
In powershell v4 Invoke-Command implements runspace jobbing for you ;) If you're talking about remote collections. It does speed up Wmi queries quite effectively though. I know you already have this, but here's a simpler version I wrote: https://gist.github.com/secabstraction/4044f4aadd3ef21f0ca9
I wrote a simple wrapper for Wmi queries if you're interested, Invoke-WmiRunspaceQuery, derived from boe's post above. https://gist.github.com/secabstraction/c484d61cbdec10261c5b