I had this in a script which I believe was working well, but appears to have stopped working:
$testList = @("object 1","object 2","object 3","object 4","object 5")
$counter = 0
$maxSize = 2
$groupedList = $testList | Group-Object { [math]::Floor($counter++ / $maxSize) }
$groupedList
$groupedList | Measure-Object
Previously Measure-Object would have given me a Count of 3, but now I receive a count of 1.
Why is this no longer working? Is the counter integer not being incremented within the Group-Object command anymore?