Question

I had a look at the properties available for objects returned by Get-ChildItem command using:

PS C:\> Get-ChildItem | Get-Member

This command shows that objects returned by Get-ChildItem command possess properties 'Name, FullName, LastAccessTime etc...'

I declare a variable to retrieve objects starting with 'Program':

PS C:\> $ChildItems_Program = Get-ChildItem -name 'Program*'

Checking what is stored in $ChildItems_Program

PS C:\> $ChildItems_Program
Program Files
Program Files (x86)

Trying to access properties 'Name, FullName, LastAccessTime' from the first object saved in $ChildItems_Program

PS C:\> $ChildItems_Program[0] | Select -Property Name, FullName, LastAccessTime

Name                                 FullName                             LastAccessTime
----                                 --------                             --------------

Why I can't see any results for above command- Shouldn't it return the properties of first object saved in $ChildItems_Program? Can anyone please guide.

Thank you!

Was it helpful?

Solution

from technet ( equivalent to get-help get-childitem )

-Name
Gets only the names of the items in the locations. If you pipe the output of this command to another command, only the item names are sent.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top