none
Properties of an object in pipeline $_.??? RRS feed

  • Question

  • Hi.

    Can anyone tell me how to loop through properties of an object in powershell?

    Eg:

     Get-ChildItem C:\Windows | ForEach-Object {$_.FullName }

    Now $_ has a bunch of properties like $_.Name, $_.LastWriteTime
    So my question is, how do I loop through the available properties? 

     

    Something like:

    Get-ChildItem C:\Windows | ForEach-Object {foreach($[property] in$_){Write-Host $prop.key +" = "+ $prop.value}}

     

    Thanks


    Tuesday, May 3, 2011 7:51 AM

Answers

All replies