How to convert string to table or objects in powershell

Question:

How can I convert the below exported text to csv so that i can use it as objects in powershell. Eg:

Text:

Answer:

Use the Get-Content cmdlet to load the file, replace two or more whitespaces with a comma and convert it to CSV using the ConvertFrom-Csv cmdlet:


If you now query your object:

You get the desired output:

Source:

How to convert string to table or objects in powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply