I have this poweshell script in text format which I am trying to execute to get the Number from the ‘Contract Details’ text file. I am not getting the desired output.It is showing ‘system.string’ as output even though am giving the indexPowerShell Script.zip (515 Bytes)
Set the TypeArgument to String and create script output variable as Collection. Also check the IsScript property. You should then be able to use psOutput(0) to get the number.
However, I do think you could avoid the PS dependency by reading you text file directly and parsing the text. Try the below steps and let know if it works.
- Use Read Text File activity to read the file content and store it in a String type variable.
- You can then use
yourStringVariable.Split(Environment.NewLine.ToCharArray)(0).Substring("Number: ".Length)to get the “Number”.
Here is an example workflow of both approaches.
ReadTextFile.xaml (8.0 KB)