I am wondering how one would tackle looping through a collection of objects, processing the elements of that collection in groups instead of singularly, as is the case in normal Foreach loops. For example, instead of this:
$items = get-vm
foreach ($item in $items) { do something }
I would like to do this:
$items = get-vm
foreach ((5)$item in $items) {do something}
Essentially, this statement intends to say foreach 5 items in items do some work.....
Can anyone show me the proper constructs required to accomplish this?