jscript loop refactor
powershell loop refactor