Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Functions: Taking input from the Pipe

Reply
 
Old 12-29-2008   #1 (permalink)
Christian Schindler


 
 

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
Old 12-29-2008   #2 (permalink)
Vadims Podans


 
 

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"...
Quote:

> 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
Reply

Thread Tools


Similar Threads
Thread Forum
Pipe a pipe command to a file VB Script
PowerShell: how to read Pipe.Input from a script? PowerShell
PowerShell: how to read Pipe.Input from a script? PowerShell
WmdHost.exe TAKING ALL RAM available, locking system, and taking f Vista hardware & devices
Getting $input size in pipelined functions PowerShell


Vista Forums 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 Ltd

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