Convert Javascript To Powershell For Loop