Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6240705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:37:11+00:00 2026-05-24T11:37:11+00:00

I have not worked with XML much so this may be a basic question

  • 0

I have not worked with XML much so this may be a basic question to most…

I want to collect information from Get-ChildItem, combined with Get-Acl, and store it in an XML file so I can use it later within PowerShell.

The issue: in order for me to use the Get-Acl I have to use a foreach loop within the pipeline, which is in turn changing the object type to system.string. So when I export that to XML it is pretty much just a flat file, not table structure.

How can I get the table structure back?

If I just do this command I can get the table structure:


Get-ChildItem . -Recurse | 
Select FullName, PSIsContainer, CreationTimeUTC, LastAccessTimeUtc, Length | 
Export-Clixml .\STIGTest\Baseline_1.xml

When I do this command, which is what I need, I get the flat file:


Get-ChildItem . -Recurse | 
foreach-object {$AclOwner = (get-acl $_.pspath).owner; $_.Fullname, $_.PSIsContainer, $_.CreationTimeUtc, $_.LastAccessUtc, $_.Length, $AclOwner} | 
Export-Clixml .\STIGTest\Baseline_2.xml

I have seen where you can convert a system object to a string but can’t seem to find where I can do the reverse. I am guessing if they stay as a system object the XML file will keep the table structure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:37:12+00:00Added an answer on May 24, 2026 at 11:37 am

    Give this one a try. It takes advantage of the fact that Select-Object can create “calculated” properties specified by an expression.

    Get-ChildItem . -Recurse | 
    Select FullName,
           PSIsContainer,
           CreationTimeUTC,
           LastAccessTimeUtc,
           Length,
           @{Name='Owner';Expression={ (Get-Acl $_.PSPath).Owner }} | 
    Export-Clixml .\STIGTest\Baseline_1.xml
    

    I wrote @{Name=...; Expression=...} for clarity but they can be shortened to @{N=...,E=...}.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have not worked with parameters in ADO.Net very much. I'm writing a custom
i have not worked with XML in a while can someone post the syntax
I'm ashamed to say it, but I have to. I have not worked with
So I've never worked with stored procedures and have not a whole lot of
I have worked on iPhone application but not aware of the formalities to submit
I believe several of us have already worked on a project where not only
have not tested on windows. but in ubuntu when u disconnect from the network,
I have not used generics much and so cannot figure out if it is
I have not seen much support for Grails to develop facebook apps.I was just
I know this is a vague open ended question. I'm hoping to get some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.