When I use the select-object cmdlet, it only grabs the first property from the list of properties given to it. For instance
Get-ChildItem C:\tmp | Select-Object Name, CreationTime, Length
Returns to me only the Name and not the CreationTime or Length. If I put CreationTime first, I get only the CreationTime returned and not the other properties. It looks like the select statement is only processing the first argument and ignoring the rest. I have even tried using the -property parameter but that didn't help either
This looks like a very basic question, but where am I going wrong on this one?
I have confirmed I have PS 3.0. Here's a verbatim copy/paste of my command lines, as you can see only the Name is returned and not the length
PS C:\tmp> $psversiontable
Name Value
---- -----
PSVersion 3.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.18046
BuildVersion 6.2.9200.16434
PSCompatibleVersions {1.0, 2.0, 3.0}
PSRemotingProtocolVersion 2.2
PS C:\tmp> Get-ChildItem | select Name,Length
Name
----
dls
gallery_uploads.txt
k.ps1
myscript.ps1
uploads.txt
Any ideas why this might be happening? I have tried this on 2 separate machines, a Windows 8 and a Windows Server 2008 R2, same result on both!