<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Potential Pipeline Pitfall</title>
	<atom:link href="http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/feed/" rel="self" type="application/rss+xml" />
	<link>http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=potential-pipeline-pitfall</link>
	<description>Advice, solutions, tips and more for the lonely Windows administrator with too much to do and not enough time.</description>
	<lastBuildDate>Tue, 07 Feb 2012 16:20:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jeffery Hicks</title>
		<link>http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-822</link>
		<dc:creator>Jeffery Hicks</dc:creator>
		<pubDate>Tue, 19 Jan 2010 12:18:17 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-822</guid>
		<description>I suppose I should read Bruce&#039;s book again.</description>
		<content:encoded><![CDATA[<p>I suppose I should read Bruce&#8217;s book again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David "Makovec" Moravec</title>
		<link>http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-820</link>
		<dc:creator>David "Makovec" Moravec</dc:creator>
		<pubDate>Tue, 19 Jan 2010 08:48:53 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-820</guid>
		<description>I am reading PowerShell in Action again and this morning I accidentaly found this:

&quot;In a pipeline, the begin clause is run for all cmdlets in in the pipeline. Then the process clause is run for the first cmdlet. ... Finally the end clauses are all run.&quot; Sequencing is cover again in chapter 7 but I haven&#039;t it now on my PC so can&#039;t check. But I am sure you have it.

David</description>
		<content:encoded><![CDATA[<p>I am reading PowerShell in Action again and this morning I accidentaly found this:</p>
<p>&#8220;In a pipeline, the begin clause is run for all cmdlets in in the pipeline. Then the process clause is run for the first cmdlet. &#8230; Finally the end clauses are all run.&#8221; Sequencing is cover again in chapter 7 but I haven&#8217;t it now on my PC so can&#8217;t check. But I am sure you have it.</p>
<p>David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffery Hicks</title>
		<link>http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-760</link>
		<dc:creator>Jeffery Hicks</dc:creator>
		<pubDate>Mon, 11 Jan 2010 20:43:50 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-760</guid>
		<description>I thought I had made that clear.  If I have these functions:

&lt;code&gt;
Function Foo-A {

	Write-Host &quot;Starting Foo-A&quot; -ForegroundColor green

	dir $env:temp &#124; where {$_.lastwritetime -gt (Get-Date).AddDays(-1)}

	Write-Host &quot;Ending Foo-A&quot; -ForegroundColor green

} #End A

Function Foo-B {

	begin {

	  Write-Host &quot;Starting Foo-B&quot; -ForegroundColor magenta
	}

	process {
 	 #Write (&quot;{0}  {1}  {2}&quot; -f $_.fullname,$_.LastWriteTime,$_.length)
  	 # Remove-Item $_.fullname -recurse -whatif
	 write $_.fullname
	}

	end {
	 Write-Host &quot;ending Foo-B&quot; -ForegroundColor magenta
	}

} #End B

Function Foo-C {

	Begin {
	 Write-Host &quot;Starting Foo-C&quot; -ForegroundColor Cyan
 	} 

	Process {
  	 #not really doing anything
  	 write-host &quot;sleeping on $_&quot; -fore Cyan
  	 sleep -milliseconds 100
 	}

	end {
	  Write-Host &quot;ending Foo-C&quot; -ForegroundColor Cyan
	}
} #End C
&lt;/code&gt;
And then run Foo-A &#124; Foo-B &#124; Foo-C  I will get output like this:
&lt;code&gt;
Starting Foo-B
Starting Foo-C
Starting Foo-A
sleeping on C:\Users\Jeff\AppData\Local\Temp\msohtmlclip1
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRA4BF.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRB851.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRC69E.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRC6B5.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRC7CF.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRD5D3.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRD8E2.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRE109.tmp.cvr
sleeping on C:\Users\Jeff\AppData\Local\Temp\jusched.log
Ending Foo-A
ending Foo-B
ending Foo-C
&lt;/code&gt;

which is what I expect.  The begin script blocks run in order, the process script blocks run in order and then the end script blocks run in order.  Foo-A is a &quot;standard&quot; function without any defined script blocks.  I think we&#039;re saying the same thing.</description>
		<content:encoded><![CDATA[<p>I thought I had made that clear.  If I have these functions:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Function Foo-A {<br />
<br />
&nbsp; &nbsp; Write-Host &quot;Starting Foo-A&quot; -ForegroundColor green<br />
<br />
&nbsp; &nbsp; dir $env:temp | where {$_.lastwritetime -gt (Get-Date).AddDays(-1)}<br />
<br />
&nbsp; &nbsp; Write-Host &quot;Ending Foo-A&quot; -ForegroundColor green<br />
<br />
} #End A<br />
<br />
Function Foo-B {<br />
<br />
&nbsp; &nbsp; begin {<br />
<br />
&nbsp; &nbsp; &nbsp; Write-Host &quot;Starting Foo-B&quot; -ForegroundColor magenta<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; process {<br />
&nbsp; &nbsp; &nbsp;#Write (&quot;{0} &nbsp;{1} &nbsp;{2}&quot; -f $_.fullname,$_.LastWriteTime,$_.length)<br />
&nbsp; &nbsp; &nbsp;# Remove-Item $_.fullname -recurse -whatif<br />
&nbsp; &nbsp; &nbsp;write $_.fullname<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; end {<br />
&nbsp; &nbsp; &nbsp;Write-Host &quot;ending Foo-B&quot; -ForegroundColor magenta<br />
&nbsp; &nbsp; }<br />
<br />
} #End B<br />
<br />
Function Foo-C {<br />
<br />
&nbsp; &nbsp; Begin {<br />
&nbsp; &nbsp; &nbsp;Write-Host &quot;Starting Foo-C&quot; -ForegroundColor Cyan<br />
&nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; Process {<br />
&nbsp; &nbsp; &nbsp;#not really doing anything<br />
&nbsp; &nbsp; &nbsp;write-host &quot;sleeping on $_&quot; -fore Cyan<br />
&nbsp; &nbsp; &nbsp;sleep -milliseconds 100<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; end {<br />
&nbsp; &nbsp; &nbsp; Write-Host &quot;ending Foo-C&quot; -ForegroundColor Cyan<br />
&nbsp; &nbsp; }<br />
} #End C</div></div>
<p>And then run Foo-A | Foo-B | Foo-C  I will get output like this:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Starting Foo-B<br />
Starting Foo-C<br />
Starting Foo-A<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\msohtmlclip1<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRA4BF.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRB851.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRC69E.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRC6B5.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRC7CF.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRD5D3.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRD8E2.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\CVRE109.tmp.cvr<br />
sleeping on C:\Users\Jeff\AppData\Local\Temp\jusched.log<br />
Ending Foo-A<br />
ending Foo-B<br />
ending Foo-C</div></div>
<p>which is what I expect.  The begin script blocks run in order, the process script blocks run in order and then the end script blocks run in order.  Foo-A is a &#8220;standard&#8221; function without any defined script blocks.  I think we&#8217;re saying the same thing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel "Jaykul" Bennett</title>
		<link>http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-759</link>
		<dc:creator>Joel "Jaykul" Bennett</dc:creator>
		<pubDate>Mon, 11 Jan 2010 20:14:40 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2010/01/potential-pipeline-pitfall/#comment-759</guid>
		<description>I believe that BOTH the begin blocks and END blocks are run in pipeline order. It doesn&#039;t looks like that in your output only because you&#039;re writing the &quot;begin&quot; message from A from the END block ;-)</description>
		<content:encoded><![CDATA[<p>I believe that BOTH the begin blocks and END blocks are run in pipeline order. It doesn&#8217;t looks like that in your output only because you&#8217;re writing the &#8220;begin&#8221; message from A from the END block <img src='http://jdhitsolutions.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

