troubleshooting Question

Powershell scripting with Get-ChildItem

Avatar of Matthew13
Matthew13Flag for United States of America asked on
Microsoft Legacy OSPowershell
4 Comments1 Solution1033 ViewsLast Modified:
I'm trying to create a Powershell script that looks through a set of directories for PST files and then export a CSV report for me. My problem is that I cannot get the proper fields to export into the CSV file. The script looks like this:
Get-ChildItem t:\*\outlook\*.pst | Group-Object Group,length

The output I get from the console looks something like this:
Count      Name                    Group
       1      162546688            {T:\joe\outlook\Personal Folders(1) backup.pst}

I can live with that. But when I run:
Get-ChildItem t:\*\outlook\*.pst | Group-Object Group,length | Export-Csv C:\output.csv
I open the created CSV file and the Group column displays "System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject]" and not the actual path to the file. Any ideas? I would also like to add in LastWriteTime if possible. Thank you.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros