Powershell Loop Through String Javascript Substring Method