Powershell: Why is my variable empty after using ForEach-Object -Parallel?
I am trying to gather data from several servers using ForEach-Object -Parallel. The variable I use is being populated within the loop, but when the loop finishes the variable is empty. $DBDetails = "SELECT @@VERSION" $VMs = ("vm1", "vm2", "vm3", "vm4", "vm5", "vm6", "vm7") $DBInventory = @() $scriptBlock = { $vm = $_ $result =… Read More Powershell: Why is my variable empty after using ForEach-Object -Parallel?