View Single Post
Old 12-04-2006   #3 (permalink)
William Stacey [C# MVP]


 
 

Re: insert object in pipe

o man, that is cool. Thank you.

--
William Stacey [C# MVP]

"Maximilian Hänel" <ngSpam@smjh.de> wrote in message
news:Or5Kg71FHHA.536@TK2MSFTNGP02.phx.gbl...
| Hi William
|
| > In a filter, is is possible to insert a new object in the pipeline?
|
| Yes, that's possible. Depending of what's your goal you could place yor
| new object in the begin section.
|
| filter myfilter
| {
| begin
| {
| $firstcall=$true
| }
| process
| {
| if($firstcall)
| {
| $firstcall=$false
| # On first call, insert an object in pipe here.
| get-date
| # uncomment next line to insert the current
| # pipline object, too
| # $_
| }
| else
| {
| # else, process each object normally.
| $_
| }
| }
| end
| {
| # The end
| }
| }
|
| hth
|
| Max


My System SpecsSystem Spec