Search notes:

PowerShell cmdLet select-XML

select-XML allows to formulate XPath queries on XML documents.
select-XML returns a Microsoft.PowerShell.Commands.SelectXmlInfo object.

Simple example

[xml] $xml = "
<root>

  <items id='1'><item>eggs</item> </items>
  <items id='2'><item>foo</item><item>bar</item><item>baz</item></items>
  <items id='3'><item>hen</item></items>

</root>"

$xml.root.items[1].item[2]
#
# baz

($xml | select-xml -xpath '/root/items[@id="2"]').value
#
# baz
Github repository about-PowerShell, path: /cmdlets/xml/select/XPath/simple.ps1

See also

Powershell command noun: XML

Index