Powershell While Loop Array Javascript Length Validation