![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Get-Member -InputObject returns generic data; bug? If I do this: Get-Command | Get-Member I get back members of CmdletInfo objects. However, if I do this: $gcm = Get-Command; Get-Member -InputObject $gcm or this: Get-Member -InputObject $(Get-Command) I get back System.Object[] information. From my understanding of InputObject, behavior should be the same whether I am piping objects in or supplying them via InputObject. Is this a bug? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Get-Member -InputObject returns generic data; bug? This behavior is by design. We don't unravel InputObject, therefore you are applying get-member on an array of CmdletInfo objects when you do "Get-Member -InputObject $gcm". While in the pipeline scenario, you are applying get-member on each individual CmdletInfo object. -- Wei Wu [MSFT] Windows PowerShell Team Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Alex K. Angelopoulos [MVP]" <a k a @ m v p s . o r g> wrote in message news:eXX7aVGlGHA.4828@TK2MSFTNGP04.phx.gbl... > If I do this: > > Get-Command | Get-Member > > I get back members of CmdletInfo objects. However, if I do this: > $gcm = Get-Command; Get-Member -InputObject $gcm > or this: > Get-Member -InputObject $(Get-Command) > I get back System.Object[] information. > > From my understanding of InputObject, behavior should be the same whether > I am piping objects in or supplying them via InputObject. Is this a bug? > > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Get-Member -InputObject returns generic data; bug? OK. And I can actually use that behavior. ![]() "Wei Wu [MSFT]" <wwu@microsoft.com> wrote in message news:erzQbjIlGHA.3776@TK2MSFTNGP03.phx.gbl... > This behavior is by design. > We don't unravel InputObject, therefore you are applying get-member on an > array of CmdletInfo objects when you do "Get-Member -InputObject $gcm". > While in the pipeline scenario, you are applying get-member on each > individual CmdletInfo object. > > -- > Wei Wu [MSFT] > Windows PowerShell Team > Microsoft Corporation > This posting is provided "AS IS" with no warranties, and confers no > rights. > > > "Alex K. Angelopoulos [MVP]" <a k a @ m v p s . o r g> wrote in message > news:eXX7aVGlGHA.4828@TK2MSFTNGP04.phx.gbl... >> If I do this: >> >> Get-Command | Get-Member >> >> I get back members of CmdletInfo objects. However, if I do this: >> $gcm = Get-Command; Get-Member -InputObject $gcm >> or this: >> Get-Member -InputObject $(Get-Command) >> I get back System.Object[] information. >> >> From my understanding of InputObject, behavior should be the same whether >> I am piping objects in or supplying them via InputObject. Is this a bug? >> >> >> > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Get-Member -InputObject returns generic data; bug? "Wei Wu [MSFT]" wrote: > This behavior is by design. > We don't unravel InputObject, therefore you are applying get-member on an > array of CmdletInfo objects when you do "Get-Member -InputObject $gcm". > While in the pipeline scenario, you are applying get-member on each > individual CmdletInfo object. Yeah, at first I got confused by that behavior too, but I think this design makes sense once you got the difference. It should be well documented in the online help though, if it isn't already. -- greetings dreeschkind |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Generic Class: Passing Data Type to Placeholder | .NET General | |||
| Initializing a generic SortedList with sorted data | .NET General | |||
| how to do Generic.List.BinarySearch on byRef data? | .NET General | |||
| Add-Member -InputObject $s -MemberType ScriptMetho | PowerShell | |||
| -inputobject vs. receiving from the pipe... | PowerShell | |||