Working with XML files

This topic contains 2 replies, has 3 voices, and was last updated by  postanote 1 week, 4 days ago.

  • Author
    Posts
  • #83819

    Tony Antony
    Participant

    I'm having a hard time understanding how to read XML files, and how to edit it. I'm not sure where to go from here.

    $xmlfile = "path to the xml file"
    [xml] $readxml = Get-Content $xmlfile

    How would I access the elements in the xml file?

  • #83822

    Hi

    Pipe it to Get-Member and start to look around. It might be something like $readxml.something or $readxml.something.else

    Regards

    Jake

  • #83834

    postanote
    Participant

    See

    'blogs.technet.microsoft.com/heyscriptingguy/2012/09/13/powertip-use-powershell-to-easily-read-an-xml-document'
    'blogs.technet.microsoft.com/heyscriptingguy/2014/02/11/powertip-use-powershell-to-edit-xml-file'

You must be logged in to reply to this topic.