Create Powershell Script From Powershell Substring Indexof