I'm trying to get all svchost
processes from my machine into a nicely formatted table, containing a formatted datetime but so far have failed to do so.
This is how I get all the processes into an array
$processes = @(gwmi -cl Win32_Process -f "name='svchost.exe'")
and following prints the datetime as I'd like it them but as a list
$processes | % {$_.Caption, $_.ConvertToDateTime($_.CreationDate)}
svchost.exe
vrijdag 4 september 2015 20:47:03
svchost.exe
vrijdag 4 september 2015 20:47:03
svchost.exe
while following prints the statements as I'd like them as a table but without the formatting of the datetime
$processes | ft Caption, CreationDate -a
Caption CreationDate
------- ------------
svchost.exe 20150904204703.429503+120
svchost.exe 20150904204703.861565+120
I can't for the life of me figure out how to print it as
Caption CreationDate
------- ------------
svchost.exe vrijdag 4 september 2015 20:47:03
svchost.exe vrijdag 4 september 2015 20:47:03