ConvertFrom-String is not available in PowerShell Core 6.1. It may reappear in a later version, or may be moved to a separate module.
ConvertFrom-String has two different styles of operation. The first behaves much as ConvertFrom-Csv does, except that it doesn't discard characters that make up the CSV format. In the following example, the quotation marks surrounding the first name are preserved:
PS> '"bob",tim,geoff' | ConvertFrom-String -Delimiter ',' -PropertyNames name1, name2, name3
name1 name2 name3
----- ----- -----
"bob" tim geoff
The default delimiter (if the parameter is not supplied) is a space. The second operating mode of ConvertFrom-String is far more complex. A template must be defined for each element of data that's to be pushed into a property.
The following example uses ConvertFrom-String to convert the output from the tasklist command into an object:
$template = '{Task*:{ImageName:System Idle Process} {[Int]PID:0} {SessionName:Services} {Session:0} {Memory:24 K}}'
tasklist |
Select-Object -Skip 3 |
ConvertFrom-String -TemplateContent $template |
Select-Object -ExpandProperty Task
The Task* element denotes the start of a data record. It allows each of the remaining fields to be grouped together under a single object.
The ConvertFrom-String command is good at dealing with well formatted data that's already divided correctly. In the case of the tasklist command, the end of a single task (or data record) is denoted by a line break.