Windows Vista Forums

Functions: Taking input from the Pipe

  1. #1


    Christian Schindler Guest

    Functions: Taking input from the Pipe

    I'm working a lot with Exchange 2007 and when I retrieve an object and format
    it with FL I get back a list of properties - but also properties that I'm not
    interested in(for example GUID, etc).

    So I normaly use SELECT to exclude those properties. However, specifying the
    properties ever and ever again is a bit boring...

    My idea was to write a function to have the same select command available
    all the time... here is the function:

    function esl {
    select * -ExcludeProperty
    Guid,ObjectCategory,ObjectClass,WhenChanged,WhenCreated,ExchangeVersion,DistinguishedName
    }

    Now my problem is that the function does NOTHING. It seems as if it doesn't
    take input from the pipe. I tried with SELECT -InputObject $_ - with no
    success...

    Any help would be appreciated!

    TIA
    Christian


      My System SpecsSystem Spec

  2. #2


    Vadims Podans Guest

    Re: Functions: Taking input from the Pipe

    your function does not receive any objects from pipe. You should specify
    that pipeline is the source:
    function esl {
    $input | select * -ExcludeProperty
    Guid,ObjectCategory,ObjectClass,WhenChanged,WhenCreated,ExchangeVersion,DistinguishedName
    }

    $input contains all objects that was received from pipeline.

    --
    WBR, Vadims Podans
    PowerShell blog - www.sysadmins.lv

    "Christian Schindler" <ChristianSchindler@xxxxxx>
    rakstīja ziņojumā
    "news:B4FE516D-ADC7-4007-97E1-A42834FA5B70@xxxxxx"...

    > I'm working a lot with Exchange 2007 and when I retrieve an object and
    > format
    > it with FL I get back a list of properties - but also properties that I'm
    > not
    > interested in(for example GUID, etc).
    >
    > So I normaly use SELECT to exclude those properties. However, specifying
    > the
    > properties ever and ever again is a bit boring...
    >
    > My idea was to write a function to have the same select command available
    > all the time... here is the function:
    >
    > function esl {
    > select * -ExcludeProperty
    > Guid,ObjectCategory,ObjectClass,WhenChanged,WhenCreated,ExchangeVersion,DistinguishedName
    > }
    >
    > Now my problem is that the function does NOTHING. It seems as if it
    > doesn't
    > take input from the pipe. I tried with SELECT -InputObject $_ - with no
    > success...
    >
    > Any help would be appreciated!
    >
    > TIA
    > Christian
    >

      My System SpecsSystem Spec

Functions: Taking input from the Pipe

Similar Threads
Thread Forum
RE: is it possible to pipe into switch -r?
Yes. switch -r (get-content t1.txt, t2.txt) { .. .. } -- Kiron
PowerShell
Pipe a pipe command to a file
I couldn't find any better place to post this, so here it is: I'm trying to find a way to echo a pipe command (>>) to a file. Basically I'm...
VB Script
PowerShell: how to read Pipe.Input from a script?
BTW: let me know if it's a wrong forum? Where is the PowerShell forum? I've integrated the PS into my project and trying to invoke a script, but,...
PowerShell
PowerShell: how to read Pipe.Input from a script?
BTW: let me know if it's a wrong forum? Where is the PowerShell forum? I've integrated the PS into my project and trying to invoke a script, but,...
PowerShell
Chinese Traditional Input using Phonetic Input
I added Chinese Traditional Input using Phonetic input keyboard (i type in chinese using bopomofo) I have no problem typing in certain...
Vista General
WmdHost.exe TAKING ALL RAM available, locking system, and taking f
See...
Vista hardware & devices
Getting $input size in pipelined functions
I apologize if this has already been asked, but a quick search didn't give me an answer. I'm pipelining an array into a function (or filter) and...
PowerShell