1
<?xml version="1.0" encoding="utf-8"?>
<Foo>
  <Tier Path="\\10.10.44.61\Case Study\" />
  <Force Path="\\10.10.44.61\Orto Study" Atomic="False" />
</Foo>

How can I read in powershell Tier Path value? I am expecting to get the value of \\10.10.44.61\Case Study\

1
  • Assuming your xml is in a variable named $xml: $xml.Foo.Tier.Path? Commented Aug 17, 2015 at 13:44

1 Answer 1

1
$xml = '<?xml version="1.0" encoding="utf-8"?>
<Foo>
  <Tier Path="\\10.10.44.61\Case Study\" />
  <Force Path="\\10.10.44.61\Orto Study" Atomic="False" />
</Foo>'

([xml]$xml).Foo.Tier.Path

As long as you are using an xml type (which I do by casting) you can reference the path directly as members of the object.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.