Forum Discussion

rmerritt's avatar
rmerritt
Copper Contributor
Dec 02, 2025

Removing extranious data from a string @{Name=WEBHOST001-OI3w}

how would I convert @{Name=WEBHOST001-OI3w} to WEBHOST001-OI3w

2 Replies

  • depends a bit on how you are getting the string that you want to split as has been mentioned elsewhere but you could most easily use ConvertFrom-StringData

    $string = "Name=WEBHOST001-OI3w"
    $converted = ConvertFrom-StringData $string
    $NameValue = $converted['Name']
    Write-Output $NameValue

     

  • Vern_Anderson's avatar
    Vern_Anderson
    Copper Contributor

    If I had more information I might be able to help.

    Is that string the output of another command or object?
    Is that string coming from Restful API queries?

    The reason I ask is a lot of times you see that output surrounded by the at symbol and curly braces when a property value contains another "child object". In those cases when you find out the Properties name you can simply pipe it to. . .

    Select-Object -ExpandProperty <insert property name>

    Tell us how to get this output ourselves so we can reproduce it and help you extract the string you were hoping to get.

Resources