In the below code if i use xpath as $XPath = "//*" I get the list of all nodes in the xml.
But if I specify specific node and all nodes under it with $XPath = "//WLANProfile//*", I get nothing.
Is there something wrong I am doing or does Powershell xpath work differently.
$path = "c:\something\wifi.xml"
$XPath = "//WLANProfile//*"
$xmlContent = [xml](Get-Content $path)
#This does not work unless $XPath is changed to "//*"
Select-Xml -Xml $xmlContent -XPath $XPath | Select-Object -ExpandProperty Node
#Just testing another way and same here only works when $XPath is equal to "//*"
@rob-simmers no special reason. I don’t work a lot with xml files and google pointed me to xpath. I was thinking this will result in spiting out all the nodes in xml and can be a template for any other similar xml file.