<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershell.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results for 'app:weblogs' matching tags '2011 Scripting Games' and 'getting started'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=app:weblogs&amp;tag=2011+Scripting+Games,getting+started&amp;orTags=0&amp;o=DateDescending</link><description>Search results for 'app:weblogs' matching tags '2011 Scripting Games' and 'getting started'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Writing Output with PowerShell</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/05/17/writing-output-with-powershell.aspx</link><pubDate>Tue, 17 May 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10428</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Microsoft PowerShell MVP, Marco Shaw, discusses writing output from Windows PowerShell. &lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Today we will be joined by Marco Shaw.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/3010.marcoshaw_5F00_4C6A01C1.jpg"&gt;&lt;img height="154" width="204" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/5008.marcoshaw_5F00_thumb_5F00_24C38597.jpg" alt="Photo of Marco Shaw" border="0" title="Photo of Marco Shaw" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Marco is a consultant with CGI in Moncton. He has been working in the IT industry for over 12 years, also working for Bell Aliant and Atlantic Lottery. He was awarded the Microsoft MVP award for his contributions to the Windows PowerShell community in 2007, 2008, 2009, and 2010. His recent authoring activities have included writing Windows PowerShell content for a Windows Server 2008 book published by Microsoft Press and writing a Windows PowerShell-related article on System Center Operations Manager 2007 for TechNet Magazine. He also provided Windows PowerShell content for a SQL Server 2008 book by SAMs publishing company and for a just released revised edition of System Center Operations Manager 2007 Unleashed by SAMs. He also coauthored the 2nd edition of PowerShell Unleashed published by SAMs, which was released early in 2009. He has spoken at Microsoft TechDays in Halifax, Canada the last two years where he has delivered sessions on System Center Operations Manager 2007 R2, Windows Server 2008 R2, and Windows PowerShell.&lt;/p&gt;
&lt;h3&gt;&lt;b&gt;Using Write-Host and Write-Output&lt;/b&gt;&lt;/h3&gt;
&lt;p&gt;When writing scripts, I&amp;rsquo;ll typically use simple quotation marks to wrap anything I want to display on the screen, but there are two cmdlets in particular that provide some extra features and can be very useful when creating scripts: &lt;b&gt;Write-Host&lt;/b&gt; and &lt;b&gt;Write-Output&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;Of the two, &lt;b&gt;Write-Host&lt;/b&gt; is typically the only one I frequently use&amp;mdash;in particular with its &lt;b&gt;NoNewLine&lt;/b&gt; switch. What &lt;b&gt;NoNewLine&lt;/b&gt; provides is a simple way to join different lines together.&lt;/p&gt;
&lt;p&gt;Here is a simple code example to demonstrate:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;ndash;NoNewLine &amp;quot;Counting from 1 to 9 (in seconds):&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;foreach($element in 1..9){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Write-Host &amp;ndash;NoNewLine&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&amp;quot;${element} &amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Start-Sleep &amp;ndash;Seconds 1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The following image shows the output of running the script. If you try running the script on your own, you will notice that it appears to be a simple counter.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/6253.figure1_5F00_4B919BD7.jpg"&gt;&lt;img height="392" width="604" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/6746.figure1_5F00_thumb_5F00_7912BB9A.jpg" alt="Image of command output" border="0" title="Image of command output" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now, there are countless ways I could have accomplished this, for example, building a simple string or simply clearing the screen each time.&lt;/p&gt;
&lt;p&gt;Something else that &lt;b&gt;Write-Host&lt;/b&gt; is useful for is when one might want to add color in their output. This can be very useful when trying to make output stand out or even just to get really flashy stuff on screen. I am going to build on the previous code snippet and blend in some colors as the numbers change.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;ndash;NoNewLine &amp;quot;Counting from 1 to 9 (in seconds):&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;foreach($element in 1..3){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Write-Host &amp;ndash;NoNewLine&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&amp;quot;${element} &amp;quot; -BackgroundColor &amp;quot;Green&amp;quot; -ForegroundColor &amp;quot;Black&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Start-Sleep &amp;ndash;Seconds 1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;foreach($element in 4..6){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Write-Host &amp;ndash;NoNewLine&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&amp;quot;${element} &amp;quot; -BackgroundColor &amp;quot;Yellow&amp;quot; -ForegroundColor &amp;quot;Black&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Start-Sleep &amp;ndash;Seconds 1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;foreach($element in 7..9){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Write-Host &amp;ndash;NoNewLine&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&amp;quot;${element} &amp;quot; -BackgroundColor &amp;quot;Red&amp;quot; -ForegroundColor &amp;quot;Black&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;Start-Sleep &amp;ndash;Seconds 1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The following image shows the result of running the previous code. The coloring uses good old traffic light colors to show the progression in groups of three. I have also changed the color in the text displayed on the console to make it clearer to see against the background colors.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/1263.figure2_5F00_38DCA220.jpg"&gt;&lt;img height="392" width="604" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/5076.figure2_5F00_thumb_5F00_4399F975.jpg" alt="Image of command output" border="0" title="Image of command output" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;OK, that was fun&amp;hellip;&lt;/p&gt;
&lt;p&gt;Now, let us dig a bit deeper. In Windows PowerShell, the host is what you, as a user, interact with. You will typically interact with the two default hosts: the Windows PowerShell console and the Windows PowerShell Integrated Scripting Environment (ISE).&lt;/p&gt;
&lt;p&gt;When you use &lt;b&gt;Write-Host&lt;/b&gt;, you are telling Windows PowerShell to simply display something in the host to the user. But what happens with Write-Host output if I&amp;rsquo;m running a script from a scheduled task or even if I do something simple like redirect my script by using the standard redirection operator (&lt;b&gt;&amp;gt;&lt;/b&gt;)? In these cases, (an example is coming up), what &lt;b&gt;Write-Host&lt;/b&gt; prints out is basically lost. In other words, if you are not watching your script when it actually is running, &lt;b&gt;Write-Host&lt;/b&gt; is not doing a whole lot for you. Basically, it is displaying information to the screen, and then &amp;ldquo;throwing it away.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;There is an excellent example that Don Jones&amp;rsquo; wrote a few years ago (for more information, see &lt;a target="_blank" href="http://concentratedtech.com/"&gt;Welcome to Concentrated Technology&lt;/a&gt;). You can see this by looking over the following image.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/2450.figure3_5F00_0363DFFB.jpg"&gt;&lt;img height="392" width="604" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/3581.figure3_5F00_thumb_5F00_7EED5F33.jpg" alt="Image of command output" border="0" title="Image of command output" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the previous image, I have used several commands. The important thing to notice between the first and second command is that in the first one, it appears that the &lt;b&gt;Where-Object&lt;/b&gt; cmdlet doesn&amp;rsquo;t work! In fact, it is working fine, and just doing what it is told. The important thing to note is what I said about &lt;b&gt;Write-Host&lt;/b&gt; &amp;ldquo;displaying stuff and throwing it away.&amp;rdquo; &lt;b&gt;Write-Host&lt;/b&gt; is the cmdlet that is responsible for displaying the numbers on the screen, and &lt;b&gt;Where-Object&lt;/b&gt; actually gets nothing at all sent to it because of the use of &lt;b&gt;Write-Host&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;In the second command, things work as one might expect. The objects are passed along the pipeline so &lt;b&gt;Where-Object&lt;/b&gt; actually works in this case, and it is able to filter the objects properly because &lt;b&gt;Write-Output&lt;/b&gt; was used instead.&lt;/p&gt;
&lt;p&gt;The above image also shows the output from a third and fourth command. They are included to show how &lt;b&gt;Write-Output&lt;/b&gt; is basically always there without having to be explicitly added. Windows PowerShell does a lot of things behind the scenes for you, and this is just one example of this.&lt;/p&gt;
&lt;p&gt;Another simple example to show the contract between the two cmdlets is to show an example that uses output redirection. Consider the following code snippet.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;quot;Phase 1&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$start=Get-Date&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Output $start&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;quot;Phase 2&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Start-Sleep -Seconds 5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;quot;Phase 3&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$end=Get-Date&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Output $end&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Host &amp;quot;Phase 4&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$diff=New-TimeSpan $start $end&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:11pt;list-style-type:disc;margin:0in 0in 10pt;text-autospace:ideograph-numeric;mso-layout-grid-align:auto;mso-vertical-align-alt:auto;"&gt;&lt;span style="line-height:12pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;Write-Output $diff&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The following image shows this script being run two different ways.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/5076.figure4_5F00_29C5C346.jpg"&gt;&lt;img height="392" width="604" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/0876.figure4_5F00_thumb_5F00_3DDEDFCF.jpg" alt="Image of command output" border="0" title="Image of command output" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As can be seen in this image, &lt;b&gt;Write-Host&lt;/b&gt; really does just that, and nothing more. &lt;/p&gt;
&lt;p&gt;I hope that I have helped clarify the differences between the two cmdlets, and when you might look to use one versus the other depending on what you are trying to accomplish.&lt;/p&gt;
&lt;p&gt;Thanks you, Marco, for helping to clarify some of the confusion between when to use &lt;b&gt;Write-Host&lt;/b&gt; and when to use &lt;b&gt;Write-Output&lt;/b&gt;. &lt;/p&gt;
&lt;p&gt;The 2011 Scripting Games Wrap-up Week will continue tomorrow when our guest blogger, Bartek Bielawski, talks the 2011 Scripting Games. &lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a target="_blank" href="http://bit.ly/scriptingguystwitter"&gt;Twitter&lt;/a&gt; and &lt;a target="_blank" href="http://bit.ly/scriptingguysfacebook"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a target="_blank" href="http://bit.ly/scriptingforum"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3428260" width="1" height="1" alt="" /&gt;</description></item><item><title>Add Excellent Comments to Your PowerShell Script</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/05/16/add-excellent-comments-to-your-powershell-script.aspx</link><pubDate>Mon, 16 May 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10417</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Microsoft Scripting Guy, Ed Wilson, shows you how to add excellent comments to your Windows PowerShell script.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Today is a celebration! No, it is not international Scripting Guy Day (that is January 11), rather today is our 1750&lt;sup&gt;th&lt;/sup&gt; Hey Scripting Guy! blog. If it seems like only a few months ago that we celebrated our &lt;a target="_blank" href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/08/copy-data-from-one-excel-spreadsheet-to-another-with-powershell.aspx"&gt;1500&lt;sup&gt;th&lt;/sup&gt; Hey Scripting Guy! blog&lt;/a&gt; (it was September 8, 2010), it is because these milestones are occurring much faster now that I switched to publishing seven days a week and 365 days a year. &lt;/p&gt;
&lt;p&gt;Anyway, that is enough preliminaries. I want to talk about something I noticed during the 2011 Scripting Games. One of the hallmarks of good script design is providing useful comments. I have written about using &lt;a target="_blank" href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/01/05/hey-scripting-guy-january-5-2010.aspx"&gt;multi-line comments&lt;/a&gt; in the past, but I do not think I have written about exactly what one should add in the comments. &lt;/p&gt;
&lt;p&gt;Rather than pick on anyone&amp;rsquo;s script, partly because many scripts in both the advanced and in the beginner categories violated this guideline, I decided to write a script with lots of bogus comments. The ScriptWithLotsOfBogusComments.ps1 appears here. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;ScriptWithLotsOfBogusComments.ps1&lt;/b&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# First connect to WMI and get information about the bios&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# Store the returned bios information into the $b variable&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$b = Get-wmiobject win32_bios&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# now I need to print out the version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# I get the version by accessing the version property&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# from the object stored in the $b variable&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$b.version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# I now need to see if the version number is greater than&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# 14. To do this, the first thing I do is split the version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# at the dash and store that in a variable called $c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# that will give me an array of two elements. The first&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# element contains the word dell and the second the number&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# of the version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$c = $b.Version -split &amp;quot;-&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# once i have the array, i want to ensure the version number&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# number has no extra spaces in it so i use trim. Trim is a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# method so i have to use () after the call. Because I am &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# working with an array and I want the second element, i use&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# [] to index into the array. I can also trim at the same time&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# I store the resulting value into the $d variable.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$d = $c[1].trim()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# Now I check the version of the bios. First I ensure I have&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# an integer by using [int] and then i use the greater than&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# operator which is -gt. The action clause of an if statement&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# is placed in a script block which consists of two curly&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# brackets.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="line-height:normal;list-style-type:disc;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-font-family:segoe;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;if([int]$d -gt 14) { &amp;quot;The bios is the latest version&amp;quot; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;I know the previous code is a bit difficult to read, but look at it in the Windows PowerShell ISE, as shown in the following image, and you can tell that it is not much better.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/1018.HSG_2D00_5_2D00_16_2D00_11_2D00_01_5F00_47A9E92C.jpg"&gt;&lt;img height="439" width="604" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/6886.HSG_2D00_5_2D00_16_2D00_11_2D00_01_5F00_thumb_5F00_6E0BCC77.jpg" alt="Image of command output" border="0" title="Image of command output" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;During the 2011 Scripting Games, I saw many scripts that were similar to the script above&amp;hellip;or worse. If you read all the comments, you will see that they are not bad comments, but they do not tell anything about the script itself. In addition, there is nothing to tell us about the logic that is used&amp;mdash;what does it mean when the script states the BIOS is the latest version? How is version 15 determined to be the latest version? What happens when the script runs on a computer that is not a Dell? There is no check for the computer version, nor is there any message other than the one that states the BIOS is the latest version if the version is greater than 15. &lt;/p&gt;
&lt;p&gt;So, although the script has massive comments, the comments are basically useless. This makes the script useless as well. As an ITPro, I do not have enough information about the script to be able to use it to ensure that my computers have the correct BIOS installed. This points to several of my best practices regarding comments. &lt;/p&gt;
&lt;h4&gt;&lt;b&gt;Best practices for comments&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;1. When commenting a script, do not explain things that anyone who has a moderate knowledge of Windows PowerShell scripting would already know. I know that the &lt;b&gt;Get-WmiObject&lt;/b&gt; cmdlet connects to WMI on the target computer, and I know that the &lt;b&gt;Win32_Bios&lt;/b&gt; WMI class returns information about the BIOS on a computer. In addition, anyone who has used Windows PowerShell for more than 15 minutes knows what a straightforward value assignment to a variable looks like. Therefore, the comment lines in the following code are useless.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# First connect to WMI and get information about the bios&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# Store the returned bios information into the $b variable&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$b = Get-wmiobject win32_bios&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;2. A good comment should explain the logic of the script. If data is returned in a particular format, and it needs grooming prior to use, it is a good practice to explain that logic in a comment. This enables the user of the script to make changes should the format of the data change in the future. In particular, this type of comment will simplify troubleshooting in the future. Unfortunately, in the following code, the comment does not really address the point of why the code is written as it is. &lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# I now need to see if the version number is greater than&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# 14. To do this, the first thing I do is split the version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# at the dash and store that in a variable called $c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# that will give me an array of two elements. The first&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# element contains the word dell and the second the number&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# of the version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$c = $b.Version -split &amp;quot;-&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# once i have the array, i want to ensure the version number&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# number has no extra spaces in it so i use trim. Trim is a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# method so i have to use () after the call. Because I am &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# working with an array and I want the second element, i use&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# [] to index into the array. I can also trim at the same time&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# I store the resulting value into the $d variable.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="line-height:normal;list-style-type:disc;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-font-family:segoe;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$d = $c[1].trim()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;3. If the script has any type of unique logic or &amp;ldquo;business rules&amp;rdquo; in it, these should be explained. In the code that follows the script checks to see if the BIOS version number is greater than 14. If it is, the script displays a message that says, &amp;ldquo;The BIOS is the latest version.&amp;rdquo; Unfortunately, the comment does not explain how the number 14 as a baseline value is obtained. Nor does it explain the limitations of the assessment, or the applicability of the results. In fact, the comment for this portion of the code simply states the obvious. In fact, it is worse than that, because it does not explain what the number 14 is doing in the code. I simply assume that the number 14 is a baseline BIOS, but that is not really explained in the comments.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# Now I check the version of the bios. First I ensure I have&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# an integer by using [int] and then i use the greater than&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# operator which is -gt. The action clause of an if statement&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# is placed in a script block which consists of two curly&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# brackets.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;if([int]$d -gt 14) { &amp;quot;The bios is the latest version&amp;quot; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, the script has lots of comments, but those comments ignore the things that should have been commented. In addition, there are so many comments, that they obscure the actual code and make it difficult to read the script. &lt;/p&gt;
&lt;p&gt;In the ScriptWithBetterComments.ps1 script that follows, I still have a lot of comments. But I have comments about future work items, and I explain the logic and business rules used in the script. This script is shown here. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;ScriptWithBetterComments.ps1&lt;/b&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# This script only runs on Dell computers&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# TODO add computer maker check to script&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# TODO add remote capability&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$b = Get-wmiobject win32_bios&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$b.version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# The version appears as Dell - 14. I match only&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# the number, so I split the number from the string.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# In future, this code might need revision if format changes.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$c = $b.Version -split &amp;quot;-&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;$d = $c[1].trim()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# Dell&amp;#39;s website states the latest bios version for our&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# computers is 14, so this is what we check here. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# TODO remove string literal and use variable. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# TODO produce output when not the latest version.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;if([int]$d -gt 14) { &amp;quot;The bios is the latest version&amp;quot; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height:13.25pt;list-style-type:disc;margin:0in 0in 8pt;"&gt;&lt;span&gt;&lt;span style="font-family:Lucida Sans Typewriter;"&gt;&lt;span style="color:#000000;"&gt;# TODO add ability to update bios if not on latest version&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In addition to writing better comments, I also placed spaces between the blocks of comments. This makes the code easier to read, as shown in the following image.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/3678.HSG_2D00_5_2D00_16_2D00_11_2D00_02_5F00_3FB246CA.jpg"&gt;&lt;img height="432" width="604" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18-metablogapi/3582.HSG_2D00_5_2D00_16_2D00_11_2D00_02_5F00_thumb_5F00_264A4390.jpg" alt="Image of command output" border="0" title="Image of command output" style="background-image:none;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;border:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That is a quick overview about using comments. 2011 Scripting Games Wrap-up Week will continue tomorrow. &lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a target="_blank" href="http://bit.ly/scriptingguystwitter"&gt;Twitter&lt;/a&gt; and &lt;a target="_blank" href="http://bit.ly/scriptingguysfacebook"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a target="_blank" href="http://bit.ly/scriptingforum"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3428249" width="1" height="1" alt="" /&gt;</description></item><item><title>Expert Solution for 2011 Scripting Games Beginner Event 8: Use PowerShell to Write Disk File Information for Excel</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/04/27/expert-solution-for-2011-scripting-games-beginner-event-8-use-powershell-to-write-disk-file-information-for-excel.aspx</link><pubDate>Wed, 27 Apr 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10138</guid><dc:creator>Anonymous</dc:creator><description>Summary : Microsoft PowerShell MVP, Doug Finke, gathers file information and writes it to a CSV file that is readable in Excel while solving 2011 Scripting Games Beginner Event 8. Microsoft Scripting Guy, Ed Wilson, here. Doug Finke is the expert commentator...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/04/27/expert-solution-for-2011-scripting-games-beginner-event-8-use-powershell-to-write-disk-file-information-for-excel.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3423090" width="1" height="1" alt="" /&gt;</description></item><item><title>The 2011 Scripting Games Beginner Event 10: Use PowerShell to Measure Time to Complete a Command</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/04/15/the-2011-scripting-games-beginner-event-10-use-powershell-to-measure-time-to-complete-a-command.aspx</link><pubDate>Fri, 15 Apr 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:9998</guid><dc:creator>Anonymous</dc:creator><description>Summary : Beginner Event 10 in 2011 Scripting Games uses Windows PowerShell to determine the amount of time a command takes to complete. About this event Division Beginner Date of Event 4/15/2011 12:01 AM Due Date 4/22/2011 12:01 AM Event scenario Your...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/04/15/the-2011-scripting-games-beginner-event-10-use-powershell-to-measure-time-to-complete-a-command.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3418449" width="1" height="1" alt="" /&gt;</description></item><item><title>Use PowerShell to Replace Text in Strings</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/03/21/use-powershell-to-replace-text-in-strings.aspx</link><pubDate>Mon, 21 Mar 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:9705</guid><dc:creator>Anonymous</dc:creator><description>Summary : The Scripting Wife learns how to use Windows PowerShell and regular expressions to replace text in strings. Microsoft Scripting Guy, Ed Wilson, here. I just finished a meeting with the Microsoft TechEd people about doing a series of five Live...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/03/21/use-powershell-to-replace-text-in-strings.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3414164" width="1" height="1" alt="" /&gt;</description></item><item><title>Filter PowerShell Output with the Out-Gridview Cmdlet</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/02/25/filter-powershell-output-with-the-out-gridview-cmdlet.aspx</link><pubDate>Fri, 25 Feb 2011 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:9488</guid><dc:creator>Anonymous</dc:creator><description>Summary : The Scripting Wife learns how to filter output by using the Windows PowerShell Out-Gridview cmdlet. I am happily anticipating this weekend in Seattle. I leave for Seattle tomorrow evening. I will be participating in a portion of the MVP summit...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/25/filter-powershell-output-with-the-out-gridview-cmdlet.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3389612" width="1" height="1" alt="" /&gt;</description></item><item><title>Scripting Wife Learns to View Data with Out-GridView</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/02/24/scripting-wife-learns-to-view-data-with-out-gridview.aspx</link><pubDate>Thu, 24 Feb 2011 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:9484</guid><dc:creator>Anonymous</dc:creator><description>Summary : The Scripting Wife learns how to view and to sort data by using the Out-GridView Windows PowerShell cmdlet. I just finished with a fun conference call with a colleague in which we were talking about how to best work with the community. Originally...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/24/scripting-wife-learns-to-view-data-with-out-gridview.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3389167" width="1" height="1" alt="" /&gt;</description></item><item><title>Format PowerShell Output with an Easy-to-Use Table</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/02/23/format-powershell-output-with-an-easy-to-use-table.aspx</link><pubDate>Wed, 23 Feb 2011 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:9465</guid><dc:creator>Anonymous</dc:creator><description>Summary : The Scripting Wife learns how to format Windows PowerShell output with the easy-to-use Format-Table cmdlet. Microsoft Scripting Guy, Ed Wilson, here. I wonder how you might describe the perfect day? For me, it consists of receiving feedback...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/23/format-powershell-output-with-an-easy-to-use-table.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3388820" width="1" height="1" alt="" /&gt;</description></item><item><title>Scripting Wife Learns to Format Wide Output with PowerShell</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/02/22/scripting-wife-learns-to-format-wide-output-with-powershell.aspx</link><pubDate>Tue, 22 Feb 2011 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:9451</guid><dc:creator>Anonymous</dc:creator><description>Summary : The Scripting Wife learns how to use the Format-Wide cmdlet in Windows PowerShell. I imagine winter has nearly departed Charlotte, North Carolina and that spring will arrive soon. Yesterday, besides being rather long, turned out to be gorgeous...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/22/scripting-wife-learns-to-format-wide-output-with-powershell.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3388385" width="1" height="1" alt="" /&gt;</description></item><item><title>Scripting Wife Learns about Formatting PowerShell Output</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/02/21/scripting-wife-learns-about-formatting-powershell-output.aspx</link><pubDate>Mon, 21 Feb 2011 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:9429</guid><dc:creator>Anonymous</dc:creator><description>Summary : The Scripting Wife learns from the Microsoft Scripting Guy about formatting Windows PowerShell output with Format-List . It is a Monday morning much like any one of hundreds of previous Mondays. The celestial orb has yet to make an appearance...(&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/21/scripting-wife-learns-about-formatting-powershell-output.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3388069" width="1" height="1" alt="" /&gt;</description></item></channel></rss>