Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

how do I find the available properties -- say of get-childitem

Closed Thread
 
Thread Tools Display Modes
Old 03-10-2007   #1 (permalink)
Art
Guest


 

how do I find the available properties -- say of get-childitem

Hi,

I'm going through the book by Payette and trying to learn something about
Powershell. I see some of the examples use get-childitem and then format the
output. For example one pipes the output to format-table name. How can I
find out what all of the properties are, including name. If I just do
get-childitem I only see a few of the available properties.

I'm guessing this question would be common to other cmdlets as well.
Old 03-10-2007   #2 (permalink)
Brandon Shell
Guest


 

Re: how do I find the available properties -- say of get-childitem

Get-ChildItem | Get-Member # this gets you everything
Get-ChildItem | Get-Member -MemberType Property

"Art" <Art@discussions.microsoft.com> wrote in message
news:C9D273EB-2DB8-4398-8194-98677B1FB352@microsoft.com...
> Hi,
>
> I'm going through the book by Payette and trying to learn something about
> Powershell. I see some of the examples use get-childitem and then format
> the
> output. For example one pipes the output to format-table name. How can I
> find out what all of the properties are, including name. If I just do
> get-childitem I only see a few of the available properties.
>
> I'm guessing this question would be common to other cmdlets as well.


Old 03-11-2007   #3 (permalink)
Art
Guest


 

Re: how do I find the available properties -- say of get-childitem

Brandon,

Thanks, that's just what I needed.


"Brandon Shell" wrote:

> Get-ChildItem | Get-Member # this gets you everything
> Get-ChildItem | Get-Member -MemberType Property
>
> "Art" <Art@discussions.microsoft.com> wrote in message
> news:C9D273EB-2DB8-4398-8194-98677B1FB352@microsoft.com...
> > Hi,
> >
> > I'm going through the book by Payette and trying to learn something about
> > Powershell. I see some of the examples use get-childitem and then format
> > the
> > output. For example one pipes the output to format-table name. How can I
> > find out what all of the properties are, including name. If I just do
> > get-childitem I only see a few of the available properties.
> >
> > I'm guessing this question would be common to other cmdlets as well.

>
>

Old 03-13-2007   #4 (permalink)
Marcel J. Ortiz [MSFT]
Guest


 

Re: how do I find the available properties -- say of get-childitem

> I'm guessing this question would be common to other cmdlets as well.

I should clarify that the available properties are not of the cmdlet, but of
the objects it produces. I just wanted you to be clear about that because
some cmdlets produce more than one type of object. For example,
get-childitem will produce different types of objects based on your
location. If you are in the registry it will produce RegistryKey objects
while if you are in the file system you will get FileInfo or DirectoryInfo
objects. So were you to pipe from get-childitem to get-member you'll see
different results based on your location.


"Art" <Art@discussions.microsoft.com> wrote in message
news:C9D273EB-2DB8-4398-8194-98677B1FB352@microsoft.com...
> Hi,
>
> I'm going through the book by Payette and trying to learn something about
> Powershell. I see some of the examples use get-childitem and then format
> the
> output. For example one pipes the output to format-table name. How can I
> find out what all of the properties are, including name. If I just do
> get-childitem I only see a few of the available properties.
>
> I'm guessing this question would be common to other cmdlets as well.


Old 03-13-2007   #5 (permalink)
klumsy@xtra.co.nz
Guest


 

Re: how do I find the available properties -- say of get-childitem

another trick to return all the properties , rather than just seeing
what they are is

Get-ChildItem | Select-Object *

or if for some reason you really want to know all about those
proproperties and are making complex decisions in code, for each
object you can access all the properties this way

(get-childitem)[0].psobject.properties

i often do things like this


[datetime]::Now | % { $_.psobject.properties }


it just contains information at a deeper level than get-member does..
and more useful when doing advanced things programatically.




Old 03-13-2007   #6 (permalink)
Art
Guest


 

Re: how do I find the available properties -- say of get-childitem

Thanks for the additional info. It's going to take me a little time to get
through all of this.

"klumsy@xtra.co.nz" wrote:

> another trick to return all the properties , rather than just seeing
> what they are is
>
> Get-ChildItem | Select-Object *
>
> or if for some reason you really want to know all about those
> proproperties and are making complex decisions in code, for each
> object you can access all the properties this way
>
> (get-childitem)[0].psobject.properties
>
> i often do things like this
>
>
> [datetime]::Now | % { $_.psobject.properties }
>
>
> it just contains information at a deeper level than get-member does..
> and more useful when doing advanced things programatically.
>
>
>
>
>

Old 03-13-2007   #7 (permalink)
Art
Guest


 

Re: how do I find the available properties -- say of get-childitem

I'm afraid I have to betray even more ignorance. How would I "be in" the
registry when using get-childitem? Actually I'm not sure how I "was in" the
file system -- I guess the file system seemed like the target of the cmdlet.
If I type get-Childitem | get-member, I haven't explicitly given the cmdlet a
target -- based on what you've said, I must be doing it implicitly somehow.
Could you explain this a bit for me?



"Marcel J. Ortiz [MSFT]" wrote:

> > I'm guessing this question would be common to other cmdlets as well.

>
> I should clarify that the available properties are not of the cmdlet, but of
> the objects it produces. I just wanted you to be clear about that because
> some cmdlets produce more than one type of object. For example,
> get-childitem will produce different types of objects based on your
> location. If you are in the registry it will produce RegistryKey objects
> while if you are in the file system you will get FileInfo or DirectoryInfo
> objects. So were you to pipe from get-childitem to get-member you'll see
> different results based on your location.
>
>
> "Art" <Art@discussions.microsoft.com> wrote in message
> news:C9D273EB-2DB8-4398-8194-98677B1FB352@microsoft.com...
> > Hi,
> >
> > I'm going through the book by Payette and trying to learn something about
> > Powershell. I see some of the examples use get-childitem and then format
> > the
> > output. For example one pipes the output to format-table name. How can I
> > find out what all of the properties are, including name. If I just do
> > get-childitem I only see a few of the available properties.
> >
> > I'm guessing this question would be common to other cmdlets as well.

>

Old 03-14-2007   #8 (permalink)
Marcel J. Ortiz [MSFT]
Guest


 

Re: how do I find the available properties -- say of get-childitem

By being "in" the registry I meant that your current location is the
registry. Part of your session state or powershell environment is your
current location. When you call any of the core cmdlets (get-help
about_core_commands) how they behave will depend on what provider (get-help
about_provider) holds your current location. If you are in the path
c:\windows, well that's part of the FileSystem and the functionality of
get-childitem will be defined by the FileSystem provider. On the other
hand, if your current location is HKLM:\Software\Microsoft then
get-childitem will be handled by the registry provider. You can get your
current location with the "get-location" cmdlet. For example, here is my
current path and the provider that the path belongs to:

PS HKLM:\software\microsoft> get-location | ft Path, Provider

Path Provider
---- --------
HKLM:\software\microsoft
Microsoft.PowerShell.Core\Registry




"Art" <Art@discussions.microsoft.com> wrote in message
news:6A84C7C8-6E65-431A-ACCD-EA843A492037@microsoft.com...
> I'm afraid I have to betray even more ignorance. How would I "be in" the
> registry when using get-childitem? Actually I'm not sure how I "was in"
> the
> file system -- I guess the file system seemed like the target of the
> cmdlet.
> If I type get-Childitem | get-member, I haven't explicitly given the
> cmdlet a
> target -- based on what you've said, I must be doing it implicitly
> somehow.
> Could you explain this a bit for me?
>
>
>
> "Marcel J. Ortiz [MSFT]" wrote:
>
>> > I'm guessing this question would be common to other cmdlets as well.

>>
>> I should clarify that the available properties are not of the cmdlet, but
>> of
>> the objects it produces. I just wanted you to be clear about that
>> because
>> some cmdlets produce more than one type of object. For example,
>> get-childitem will produce different types of objects based on your
>> location. If you are in the registry it will produce RegistryKey objects
>> while if you are in the file system you will get FileInfo or
>> DirectoryInfo
>> objects. So were you to pipe from get-childitem to get-member you'll see
>> different results based on your location.
>>
>>
>> "Art" <Art@discussions.microsoft.com> wrote in message
>> news:C9D273EB-2DB8-4398-8194-98677B1FB352@microsoft.com...
>> > Hi,
>> >
>> > I'm going through the book by Payette and trying to learn something
>> > about
>> > Powershell. I see some of the examples use get-childitem and then
>> > format
>> > the
>> > output. For example one pipes the output to format-table name. How
>> > can I
>> > find out what all of the properties are, including name. If I just do
>> > get-childitem I only see a few of the available properties.
>> >
>> > I'm guessing this question would be common to other cmdlets as well.

>>


Old 03-14-2007   #9 (permalink)
Art
Guest


 

Re: how do I find the available properties -- say of get-childitem

Marcel,

Thanks very much. It's funny how I can wind up learning about things I
didn't expect when pursuing different information. I was never aware that I
could change to the registry from within powershell. Thanks for all your
help.



"Marcel J. Ortiz [MSFT]" wrote:

> By being "in" the registry I meant that your current location is the
> registry. Part of your session state or powershell environment is your
> current location. When you call any of the core cmdlets (get-help
> about_core_commands) how they behave will depend on what provider (get-help
> about_provider) holds your current location. If you are in the path
> c:\windows, well that's part of the FileSystem and the functionality of
> get-childitem will be defined by the FileSystem provider. On the other
> hand, if your current location is HKLM:\Software\Microsoft then
> get-childitem will be handled by the registry provider. You can get your
> current location with the "get-location" cmdlet. For example, here is my
> current path and the provider that the path belongs to:
>
> PS HKLM:\software\microsoft> get-location | ft Path, Provider
>
> Path Provider
> ---- --------
> HKLM:\software\microsoft
> Microsoft.PowerShell.Core\Registry
>
>
>
>
> "Art" <Art@discussions.microsoft.com> wrote in message
> news:6A84C7C8-6E65-431A-ACCD-EA843A492037@microsoft.com...


Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
get-childitem bug? RJ PowerShell 2 02-29-2008 01:29 PM
using Get-ChildItem foamy PowerShell 9 02-15-2008 04:32 AM
get-childitem Brandon Shell [MVP] PowerShell 4 12-03-2007 12:58 PM
Cannot access properties in "local area connection properties" win Samzabrus Vista networking & sharing 2 10-09-2007 10:00 AM
Registry and Get-ChildItem fixitchris PowerShell 7 11-14-2006 06:02 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50