Powershell.org viewer for awhile, first time asker. I have a question and see if anyone to offer assitance on what I am trying to do or provide a better/different way of doing it.
I am using VMWare.PowerCLI to get a list of VMs and some stats. I am keeping everything object and my last pipe line is a sort on one of the objects. So I have a large set of sorted objects. I want to pipe or foreach-object these objects in split them into four different arrays. Object.1 -> Array1 Object.2 -> Array2 Object.3 -> Array3 Object.4 -> Array4 Object.5 -> Array1 etc.
The goal is I am trying to evenly distribute my collection of Objects into Four Smaller roughly equal Arrays or Objects.
$vmusedspace = Get-VM | Select-Object Name, UsedSpaceGB | Sort-Object UsedSpaceGB -Descending $Job01 = @() $Job02 = @() $Job03 = @() $Job04 = @()
$vmusedspace will have ~1000 objects in it sorted by UsedSpaceGB of the VM. I want $Job01 to contain 250 of the VMs, $job02 to contain 250 of the VMs, etc. With the UsedSpaceGB roughly the same between the four arrays.