An alternative approach is to use the convertfrom-stringdata cmdlet, documented here:
Link to official MS documentation
The ConvertFrom-StringData cmdlet converts a string that contains one or more key and value pairs into a hash table. Because each key-value pair must be on a separate line, here-strings are often used as the input format. By default, the key must be separated from the value by an equals sign (=) character.
Using the OP's example as in @Karolina Ochlik's post:
$text = "@{id = 04cc943e-14a8-4bf6-8601-bd6fde3cc229; name = 7.10 10-16 - 6.0 * * * * | 1 0 0 0; privileges =}"
#this is to get rid of @{}
$preparedText = $text.Substring(2,$text.Length-3)
# replace semicolon with newline - `n needs double quotes
$preparedText.replace(';',"`n") | ConvertFrom-StringData
This creates the output:
Name Value
---- -----
name 7.10 10-16 - 6.0 * * * * | 1 0 0 0
id 04cc943e-14a8-4bf6-8601-bd6fde3cc229
privileges
the real work is done in the single line
$preparedText.replace(';',"`n") | ConvertFrom-StringData
I hope this helps someone.