Are there many VMs in the cluster you used ?
It could be that PowerShell is reaching its max memory.
Can you try to run it with a little less VMs ?
I just did another test with the script and I didn't have any problems, it returned the expected results.