moorthy_kulumani
asked on
Powershell script to get file properties to a CSV file
I have requirement to capture following file properties using powershell.
I am using Get-childitem to get following.
$1= Get-ChildItem -recurse | Select-Object Name
$2= Get-ChildItem -recurse | Select-Object CreationTime
$3= Get-ChildItem -recurse | Select-Object LastAccessTime
$4= Get-ChildItem -recurse | Select-Object LastWriteTime
$5= Get-ChildItem -recurse | Select-Object Fullname
Then using $5 variable I wanted to run Get-Acl (only owner) to get the owner. But that is not working.
At the end I would like to have all the results in a single CSV file. like below.
Name - Owner- CreationTime - LastAccessTime - LastWriteTime - Fullname.
I have couple of problems
1- There are file names with space in it. So when using Fullname variable ($5) I have to put double quotes..Note sure how to add double quotes.
2- Even though I get results using Get-Acl not sure how to merge all the columns in to single CSV file.
Appreciate your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Have a good day...