Skip to content

Instantly share code, notes, and snippets.

@atao
Last active June 15, 2016 09:15
Show Gist options
  • Save atao/c5833a6942414807920acd7fc3ac6614 to your computer and use it in GitHub Desktop.
Save atao/c5833a6942414807920acd7fc3ac6614 to your computer and use it in GitHub Desktop.
$xml = [xml]@'
<Users>
<User Name="Foo">
<Friends>
<Friend Name="Bar"/>
</Friends>
</User>
<User Name="Foo2" />
<User Name="Foo3">
<Friends>
<Friend Name="Bar"/>
</Friends>
</User>
</Users>
'@
Select-Xml '//User[contains(Friends/Friend/@Name, "Bar")]' $xml |%{$_.Node.Name}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment