How do I filter the output of raw XML data?

Welcome Forums General PowerShell Q&A How do I filter the output of raw XML data?

This topic contains 1 reply, has 2 voices, and was last updated by

2 years, 8 months ago.

  • Author
  • #46032

    Points: 0
    Rank: Member

    I want to print out only specific meta data about the files and folders in a remote folder that is accessible via REST commands. I am using this code:

    $test = Invoke-WebRequest -Uri ""
    echo $test.content is a Rest URL (semi-website) with a directory of files and other subdirectories

    The above two lines of PowerShell code print raw XML data. This data is metadata about the folder found when you browse to

    How do I make the output print four exclusive types of items? I want to print a list of every file in the directory. So the four things are file name, file size, the user account who created the file (or the name of the file creator), and the time the file was last modified.

    Since the current two lines print out data like this:


    how do I select the content (or the entire line unformatted) for the four traits of metadata I mentioned?

    A helpful response to this post would include generic info about how to do it (e.g., "find the four lines you want returned and use the field descriptor to the left of the equals sign"). I found that piping my two lines of PowerShell code to a "select-string" clause does not help. If a pattern match is found, all the content is returned. Otherwise nothing is returned.

    One way around my problem is to redirect the output to a file. I then modify this file and use individual lines separately with the select-string option. I'd rather not use this because of the excessive I/O to the disk.

    My main question is, how do I print out only specific XML elements of each file that is listed and returned with my two lines of PowerShell code at the top. A second question is, what is the owner? The account that created the file?

  • #46036

    Points: 0
    Rank: Member

    Your question is really close to the October 2015 Scripting games challenge. Take a look at the official answer and the submissions

The topic ‘How do I filter the output of raw XML data?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort