locked
Hello Team! New to PowerShell Question RRS feed

  • Question

  • I have been asked to list all the files and owners throughout an entire folder.  Instead of opening the properties of each one (that would take forever) I'm thinking a PowerShell script would save huge amounts of time.  Could someone please assist?  A bonus would be listing the filesize as well but most important is the list of files and ownership.

    Many thanks in advance.  

    -Stephen 

    Wednesday, February 27, 2019 4:16 PM

Answers

  • Hi,

    Get-ChildItem -Path "c:\test\" -Recurse -File | Select-Object name,@{n="size";e={$_.length/1kb}},@{n="owner";e={(get-acl $_.fullname).owner}} 

    Please replace the file path.

    Best Regards,

    Lee


    Just do it.

    Thursday, February 28, 2019 8:47 AM

All replies

  • Here is one liner off the top of my head:

    Get-ChildItem -Recurse -File | get-acl | select path,Owner

    Rahamim.

    Wednesday, February 27, 2019 4:26 PM
  • Hi,

    Get-ChildItem -Path "c:\test\" -Recurse -File | Select-Object name,@{n="size";e={$_.length/1kb}},@{n="owner";e={(get-acl $_.fullname).owner}} 

    Please replace the file path.

    Best Regards,

    Lee


    Just do it.

    Thursday, February 28, 2019 8:47 AM
  • I will try that today, thank you.  
    Thursday, February 28, 2019 2:23 PM
  • Perfect!!!  Thank you.  
    Thursday, February 28, 2019 2:24 PM