I'm trying to export particular meta data from exe files running processes. Ideally everything listed in the VersionInfo tabbed in section., plus the dates. I've been finding PowerShell pretty logical and straight forward so far, but this has me stumped.
I've been trying a whole host of different ways to do this,. And it works if I use out-file, but I'd like the data to be exported as a csv.
I guess I have 2 problems, 1 the Select-Object doesn't seem to access the VersionInfo sub-properties and when ever I try to export it to CSV it fails.
Is there a way of appending objects together, so that they can be handled correctly by the export-csv? Or selecting the data and converting to csv, before appending?
$arr = Get-WmiObject Win32_Process -Computer $MachineName | select ExecutablePath -ExpandProperty ExecutablePath
$data = $null
foreach ($File in $arr)
if (-Not ([string]::IsNullOrWhitespace($file)))
$Data += Get-ItemProperty -Path $File | Format-list -Property * -Force
#$Data += Get-ItemProperty -Path $File | Select-Object VersionInfo | ConvertTo-Csv
$Data | export-csv $FullPath
This kind of data, but in a single CSV for all files.
VersionInfo : File: C:\Windows\system32\taskho
FileVersion: 6.3.9600.16384 (winblue_rtm.130821-1623)
FileDescription: Host Process for Windows Tasks
Product: Microsoft® Windows® Operating System
Language: English (United States)
CreationTime : 22/11/2014 12:44:54 PM
CreationTimeUtc : 22/11/2014 1:44:54 AM
LastAccessTime : 25/08/2016 1:51:39 PM
LastAccessTimeUtc : 25/08/2016 3:51:39 AM
LastWriteTime : 22/11/2014 12:44:54 PM
LastWriteTimeUtc : 22/11/2014 1:44:54 AM