• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Functions: Taking input from the Pipe

  • Thread starter Christian Schindler
  • Start date
C

Christian Schindler

#1
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 Computer

V

Vadims Podans

#2
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 Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)