Nested ForEach Alternatives?

I need to run the code below on about 200 client machines. The code works as I intended, but I’m wondering if there is a more efficient way to do this without using nested ForEach loops? Nesting loops just doesn’t seem efficient to me.

Any suggestions?

foreach ($Computer in $ComputerName){
   
   ############ Java Product Info
   
   $JavaVer = Get-ChildItem "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" -Recurse |
                ForEach-Object { Get-ItemProperty $_.pspath } | Where-Object DisplayName -Like "*Java 8*" | Select-Object DisplayVersion
}

Using Workflow and the -Parallel could be one option:

https://technet.microsoft.com/en-us/library/jj713711.aspx
https://technet.microsoft.com/en-us/library/jj574157.aspx

Using Invoke-Parallel might be another:

https://gallery.technet.microsoft.com/scriptcenter/Foreach-Parallel-Parallel-a8f3d22b

http://serverfault.com/questions/626711/how-do-i-run-my-powershell-scripts-in-parallel-without-using-jobs

Using jobs on all your nodes might be a third
(not the most used as it has its issues but still a possibility)
http://stackoverflow.com/questions/4016451/can-powershell-run-commands-in-parallel

In my use case scenario, is it safe to say the performance difference in all those options are probably negligible at best? I know I can use Measure-Command, but how accurate a measure of performance is that?

Something like:

 $JavaVer = Invoke-Command $ListOfComputerNames {
     Get-ChildItem "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" -Recurse |
     ForEach-Object { Get-ItemProperty $_.pspath } | Where-Object DisplayName -Like "*Java 8*" | Select-Object DisplayVersion
}

Would also work just fine. Invoke-Command is going to be a lot faster than using a foreach loop with 200 computers. Invoke-Command takes an array of strings also so you can simply just give it every machine name at the same time. Give it a shot. Let us know how you go.