<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Endeavour &#187; PowerShell</title>
	<atom:link href="http://www.johndcook.com/blog/category/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johndcook.com/blog</link>
	<description>The blog of John D. Cook</description>
	<lastBuildDate>Fri, 30 Jul 2010 17:20:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Updating &#8220;PowerShell Day 1&#8243; for PowerShell version 2.0</title>
		<link>http://www.johndcook.com/blog/2010/02/01/updating-powershell-day-1-for-powershell-version-2-0/</link>
		<comments>http://www.johndcook.com/blog/2010/02/01/updating-powershell-day-1-for-powershell-version-2-0/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 18:30:32 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=4381</guid>
		<description><![CDATA[Last year I wrote a little 10-page booklet called PowerShell Day 1. It covers many of the things I wish I had known when I started using PowerShell.

How do I configure PowerShell?
How do I make PowerShell launch faster?
How do I get documentation?
Why did PowerShell make some of the design decisions they did?
Once I’ve written some [...]]]></description>
			<content:encoded><![CDATA[<p>Last year I wrote a little 10-page booklet called <a href="http://www.johndcook.com/powershellbooklet.html">PowerShell Day 1</a>. It covers many of the things I wish I had known when I started using PowerShell.</p>
<ul>
<li>How do I configure PowerShell?</li>
<li>How do I make PowerShell launch faster?</li>
<li>How do I get documentation?</li>
<li>Why did PowerShell make some of the design decisions they did?</li>
<li>Once I’ve written some useful functions and scripts, where do I put them?</li>
<li>Where can I find more PowerShell resources?</li>
</ul>
<p>Now I&#8217;ve started updating the booklet to reflect changes in PowerShell version 2.0. I haven&#8217;t had a lot of experience with version 2.0 and would appreciate your help updating the booklet. I have put a link to an alpha version of the update for version 2.0 on the <a href="http://www.johndcook.com/powershellbooklet.html">download page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2010/02/01/updating-powershell-day-1-for-powershell-version-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell 2.0 for Windows XP etc.</title>
		<link>http://www.johndcook.com/blog/2009/11/02/powershell-2-0-for-windows-xp-etc/</link>
		<comments>http://www.johndcook.com/blog/2009/11/02/powershell-2-0-for-windows-xp-etc/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 14:56:28 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=3574</guid>
		<description><![CDATA[PowerShell version 2.0 shipped with Windows 7 and with Windows Server 2008 R2, but it only recently became available for other versions of Windows.
The release of PowerShell 2.0 has been more like a leak than a product launch. The announcement page hardly reads like an announcement. The title reads &#8220;Description of the Windows Management Framework [...]]]></description>
			<content:encoded><![CDATA[<p>PowerShell version 2.0 shipped with Windows 7 and with Windows Server 2008 R2, but it only recently became available for other versions of Windows.</p>
<p><strong>The release of PowerShell 2.0 has been more like a leak than a product launch</strong>. The <a href="http://support.microsoft.com/kb/968929">announcement page</a> hardly reads like an announcement. The title reads &#8220;Description of the Windows Management Framework on Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008.&#8221; What&#8217;s this &#8220;Windows Management Framework&#8221;? I&#8217;ve never heard of that. I just want the new PowerShell. The first time I saw this page was when someone sent me a link saying PowerShell 2.0 was available for XP. I thought they&#8217;d sent me the wrong link by mistake because I didn&#8217;t see anything about PowerShell at first. Only if you scroll down to the middle of a long page can you see links to download PowerShell.</p>
<p>I expected something more like the following.</p>
<h1>PowerShell 2.0 Released</h1>
<p><strong>Download for your platform</strong>:</p>
<ul>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=60cb5b6c-6532-45e0-ab0f-a94ae9ababf5">XP</a></li>
<li>Vista (<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=f2fa1227-9a34-4e29-aa03-62f5c00e16f2">32 bit</a>, <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=0f73efa2-f8d6-45f3-a8f8-5cdc205b119a">64 bit</a>)</li>
<li>Server 2003 (<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=f002462b-c8f2-417a-92a3-287f5f81407e">32 bit</a>, <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=909bbcf1-bd78-4e03-8c83-69434717e551">64 bit</a>)</li>
<li>Server 2008 (<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=863e7d01-fb1b-4d3e-b07d-766a0a2def0b">32 bit</a>, <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=d37e25cf-db05-4b23-a852-cdf865d81b82">64 bit</a>)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/11/02/powershell-2-0-for-windows-xp-etc/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Finding embarrassing and unhelpful error messages</title>
		<link>http://www.johndcook.com/blog/2009/10/07/finding-embarrassing-and-unhelpful-error-messages/</link>
		<comments>http://www.johndcook.com/blog/2009/10/07/finding-embarrassing-and-unhelpful-error-messages/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 12:08:45 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[Grammar]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Quality]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=3378</guid>
		<description><![CDATA[Every time your software displays an error message, you risk losing credibility with your users. If the message is grammatically incorrect, your credibility definitely goes down a notch. And if the message is unhelpful, your credibility goes down at least one more notch. The same can be said for any message, but error messages are [...]]]></description>
			<content:encoded><![CDATA[<p>Every time your software displays an error message, you risk losing credibility with your users. If the message is grammatically incorrect, your credibility definitely goes down a notch. And if the message is unhelpful, your credibility goes down at least one more notch. The same can be said for any message, but error messages are particularly important for three reasons.</p>
<ol>
<li>Users are in a bad mood when they see error messages; this is not the time to make things worse.</li>
<li>Programmers are sloppy with error messages because they&#8217;re almost certain the messages will never be displayed.</li>
<li>Error conditions are unusual by their very nature, and so it&#8217;s practically impossible to discover them all by black-box testing.</li>
</ol>
<p>The best way to find error messages is to search the source code for text potentially displayed to users. I&#8217;ve advocated this practice for years and usually I encounter indifference or resistance. And yet nearly every time I extract the user-visible text from a software project I find dozens of spelling errors, grammar errors, and incomprehensible messages.</p>
<p>Last year I wrote an article for CodeProject on this topic and provided a script to strip text strings from source code. See <a href="http://www.codeproject.com/KB/string/TextReview.aspx">PowerShell Script for Reviewing Text Shown to Users</a>. The script looks for all quoted text and text inside XML entities. Then it tries to filter out text strings that are not displayed to users. For example, a string with no spaces is more likely to be a file name or some other code fragment than a user message. The script produces a report that a copy editor can then review. In addition to checking spelling and grammar, an editor can judge whether a message would be comprehensible and useful.</p>
<p>I admit that the parsing in the script is crude. It could miss some strings, and it could filter out some strings that it should keep. But the script is very simple, less than 100 lines. And it works on multiple source code types: C++, C#, XML, VB, etc. Writing a sophisticated parser for each of those languages would be a tremendous amount of work, but a quick-and-dirty script may be 98% as effective. Since most projects review 0% of their source code text, reviewing 98% is an improvement.</p>
<p>In addition to improving the text that a user sees, a text review gives some insight into a program&#8217;s structure. For example, if messages are repeated in multiple files, most likely the code has a lot of &#8220;clipboard inheritance,&#8221; code copied and pasted rather than isolated into reusable functions. A text review could also determine  whether a program is concatenating strings to build SQL statements rather than calling stored procedures, possibly indicating a security vulnerability.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/10/07/finding-embarrassing-and-unhelpful-error-messages/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PowerShell news</title>
		<link>http://www.johndcook.com/blog/2009/08/13/powershell-news/</link>
		<comments>http://www.johndcook.com/blog/2009/08/13/powershell-news/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 14:14:00 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2831</guid>
		<description><![CDATA[I found out some PowerShell news by listening to the PowerScripting podcast this morning. Here are a couple things I found interesting. See the podcast show notes for more news.
First, a new version of the PowerShell Community Extensions came out last week, version 1.2. See Keith Hill&#8217;s summary of the changes.
Second, Bruce Payette is working [...]]]></description>
			<content:encoded><![CDATA[<p>I found out some PowerShell news by listening to the <a href="http://powerscripting.wordpress.com/">PowerScripting podcast</a> this morning. Here are a couple things I found interesting. See the podcast show notes for more news.</p>
<p>First, a new version of the <a href="http://pscx.codeplex.com/">PowerShell Community Extensions</a> came out last week, version 1.2. See <a href="http://keithhill.spaces.live.com/Blog/cns!5A8D2641E0963A97!7108.entry">Keith Hill&#8217;s summary</a> of the changes.</p>
<p>Second, Bruce Payette is working on a second edition of his book <a href="http://www.manning.com/payette2/">PowerShell in Action</a>. You can get an &#8220;early access&#8221; version of the book through the publisher, Manning.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/08/13/powershell-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding fonts to the PowerShell and cmd.exe consoles</title>
		<link>http://www.johndcook.com/blog/2009/07/24/windows-console-fonts/</link>
		<comments>http://www.johndcook.com/blog/2009/07/24/windows-console-fonts/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 18:40:11 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2727</guid>
		<description><![CDATA[The default font options for the PowerShell console are limited: raster fonts and Lucida Console. Raster fonts are the default, though Lucida Console is an improvement. In my opinion, Consolas is even better, but it&#8217;s not on the list of options.
Mastering PowerShell by Tobias Weltner explains how to expand the list of font options for [...]]]></description>
			<content:encoded><![CDATA[<p>The default font options for the PowerShell console are limited: raster fonts and Lucida Console. Raster fonts are the default, though Lucida Console is an improvement. In my opinion, <a href="http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/">Consolas</a> is even better, but it&#8217;s not on the list of options.</p>
<p><a href="http://powershell.com/cs/blogs/ebook/default.aspx">Mastering PowerShell</a> by Tobias Weltner explains how to expand the list of font options for the PowerShell console. The same trick increases the list of font options in the Windows command prompt <code>cmd.exe</code> as well. The book is free for download. See page 16 for details. However, I have two comments about the instructions it gives.</p>
<p>First, the book says &#8220;The name must be exactly the same as the official font name, just the way it&#8217;s stated under [registry key].&#8221; However, the Consolas font is listed in the registry as &#8220;Consolas (True Type)&#8221;. You should enter &#8220;Consolas&#8221; and leave out the parenthetical description.</p>
<p>Second, the book says &#8220;the new font will work only after you either log off at least once or restart your computer.&#8221; When I tried it, logging off was not sufficient; I had to reboot my computer before the font change would work.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/08/17/improved-powershell-prompt/">Improved PowerShell prompt</a><br />
<a href="http://www.johndcook.com/blog/2009/06/10/a-couple-thoughts-on-typography/">A couple thoughts on typography</a><br />
<a href="http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/">Better R console fonts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/07/24/windows-console-fonts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Comparing the Unix and PowerShell pipelines</title>
		<link>http://www.johndcook.com/blog/2009/06/09/comparing-the-unix-and-powershell-pipelines/</link>
		<comments>http://www.johndcook.com/blog/2009/06/09/comparing-the-unix-and-powershell-pipelines/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 12:40:24 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2445</guid>
		<description><![CDATA[This is a blog post I&#8217;ve intended to write for some time now. I intended to come up with a great example, but I&#8217;ve decided to go ahead and publish it and let you come up with your own examples. Please share your examples in the comments.
One of the great strengths of Unix is the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a blog post I&#8217;ve intended to write for some time now. I intended to come up with a great example, but I&#8217;ve decided to go ahead and publish it and let you come up with your own examples. Please share your examples in the comments.</p>
<p>One of the great strengths of Unix is the shell pipeline. Unix has thousands of little utilities that can be strung together via a pipeline. The output of one program can be the input to another. But in practice, things don&#8217;t go quite so smoothly. Suppose the conceptual pattern is</p>
<p style="padding-left: 30px;"><code>A | B | C</code></p>
<p>meaning the output of <code>A</code> goes to <code>B</code>, and the output of <code>B</code> goes to <code>C</code>. This is actually implemented as</p>
<p style="padding-left: 30px;"><code>A | &lt;grubby text munging&gt; | B | &lt;grubby text munging&gt; | C</code></p>
<p>because <code>B</code> doesn&#8217;t really take the output of <code>A</code>. There&#8217;s some manipulation going on to prepare the output of <code>A</code> as the input of <code>B</code>. Strip these characters from these columns, replace this pattern with this other pattern, etc. The key point is the <strong>Unix commands spit out text</strong>. Maybe at a high level you care about programs <code>A</code>, <code>B</code>, and <code>C</code>, but in between are calls to utilities like <code>grep</code>, <code>sed</code>, or <code>awk</code> to bridge the gaps between output formats and input formats.</p>
<p>The PowerShell pipeline is different because <strong>PowerShell commands spit out objects</strong>. For example, if the output of a PowerShell command is a date, then the command returns a .NET object representing a date, not a text string. The command may <em>display</em> a string on the command line, but that string is just a human-readable representation. But the string representation of an object is not the object. If the output is piped to another command, the latter command receives a .NET date object, not a string. This is the big idea behind PowerShell. Commands pass around objects, not strings. The grubby, error-prone text munging between commands goes away.</p>
<p>Not all problems go away just because commands pass around objects. For example, maybe one command outputs a COM object and another takes in a .NET object. This is where more PowerShell magic comes in. PowerShell does a lot of work behind the scenes to implicitly convert output types to input types when possible. This sort of magic makes me nervous when I&#8217;m programming. I like to know exactly what&#8217;s going on, especially when debugging. But when using a shell, magic can be awfully convenient.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/06/09/comparing-the-unix-and-powershell-pipelines/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Would you rather have a chauffeur or a Ferrari?</title>
		<link>http://www.johndcook.com/blog/2009/05/14/would-you-rather-have-a-chauffeur-or-a-ferrari/</link>
		<comments>http://www.johndcook.com/blog/2009/05/14/would-you-rather-have-a-chauffeur-or-a-ferrari/#comments</comments>
		<pubDate>Thu, 14 May 2009 14:18:39 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2281</guid>
		<description><![CDATA[Dan Bricklin commented in a recent interview on how the expectations of computers from science fiction have not panned out. The point is not that computers are more or less powerful than expected, but that we have wanted to put computers to different uses than expected.

Fictional computers such as the HAL 9000 from 2001: A [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Dan_Bricklin">Dan Bricklin</a> commented in a recent <a href="http://itc.conversationsnetwork.org/shows/detail4096.html">interview</a> on how the expectations of computers from science fiction have not panned out. The point is not that computers are more or less powerful than expected, but that we have wanted to put computers to different uses than expected.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/ferrari.jpg" alt="photo of red Ferrari" width="288" height="206" /></p>
<p>Fictional computers such as the HAL 9000 from <a href="http://www.amazon.com/gp/product/B000Q66J1M?ie=UTF8&amp;tag=theende-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=B000Q66J1M">2001: A Space Odyssey</a> were envisioned as chauffeurs. You tell the computer what to do and then go along passively for the ride. Bricklin says it looks like <strong>people would rather have a Ferrari than a chauffeur</strong>. We want our computers to be powerful tools, but we want to be actively involved in using them.</p>
<p>I&#8217;d refine that to say we either want to actively use our computers, or we want them to be invisible. Maybe there&#8217;s an <a href="http://www.johndcook.com/blog/2008/12/17/the-uncanny-valley-of-ui-design/">uncanny valley</a> between these extremes. Most people are blissfully ignorant of the computers embedded in their cars, thermostats, etc. But they don&#8217;t want some weird <strong>HAL 9000-Clippy hybrid</strong> saying &#8220;Dave, it looks like you&#8217;re updating your résumé. I&#8217;ll take care of that for you.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/05/14/would-you-rather-have-a-chauffeur-or-a-ferrari/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>PowerShell eBook update</title>
		<link>http://www.johndcook.com/blog/2009/05/09/powershell-ebook-update/</link>
		<comments>http://www.johndcook.com/blog/2009/05/09/powershell-ebook-update/#comments</comments>
		<pubDate>Sat, 09 May 2009 12:12:01 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2255</guid>
		<description><![CDATA[I just posted a new version of PowerShell Day 1 that corrects a couple typos.
]]></description>
			<content:encoded><![CDATA[<p>I just posted a new version of <a href="http://www.johndcook.com/powershellbooklet.html">PowerShell Day 1</a> that corrects a couple typos.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/05/09/powershell-ebook-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PowerShell browser toolbar</title>
		<link>http://www.johndcook.com/blog/2009/04/15/powershell-browser-toolbar/</link>
		<comments>http://www.johndcook.com/blog/2009/04/15/powershell-browser-toolbar/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 07:31:34 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2022</guid>
		<description><![CDATA[Shay Levy created an amazing browser toolbar for PowerShell. The toolbar works with IE and Firefox. It updates itself using data that Shay maintains. It lets you do Google searches tailored to PowerShell sites, lists popular PowerShell blogs, and has a menu for a wide variety of PowerShell resources. Shay released his toolbar back in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.microsoft.co.il/blogs/scriptfanatic/">Shay Levy</a> created an amazing <a href="http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2008/06/29/powershell-at-the-tip-of-your-browser.aspx">browser toolbar</a> for PowerShell. The toolbar works with IE and Firefox. It updates itself using data that Shay maintains. It lets you do Google searches tailored to PowerShell sites, lists popular PowerShell blogs, and has a menu for a wide variety of PowerShell resources. Shay released his toolbar back in June 2008, so this is old news to people more in the know than I am, but I just found out about it yesterday.</p>
<p>I&#8217;m not a big fan of toolbars. I installed the toolbar but will keep it hidden most of the time. But I&#8217;m glad I installed it just to see Shay&#8217;s list of resources.</p>
<p>Shay created his toolbar using <a href="http://www.conduit.com/">Conduit</a>, something else I&#8217;d not heard of. Looks like Conduit makes it easy to create other similar toolbars. (Easy in the sense of programming effort; I&#8217;m sure a lot of work goes into keeping the resource lists up to date once you&#8217;ve created the toolbar.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/04/15/powershell-browser-toolbar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Free PowerShell booklet: What I wish I&#8217;d known up front</title>
		<link>http://www.johndcook.com/blog/2009/04/14/free-powershell-ebook/</link>
		<comments>http://www.johndcook.com/blog/2009/04/14/free-powershell-ebook/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 10:34:14 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2006</guid>
		<description><![CDATA[I&#8217;ve written a small booklet, 10 pages, of things I wish someone had told me when I first started using Windows PowerShell.
Download here: PowerShell Day 1
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a small booklet, 10 pages, of things I wish someone had told me when I first started using Windows PowerShell.</p>
<p>Download here: <a href="http://www.johndcook.com/powershellbooklet.html">PowerShell Day 1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/04/14/free-powershell-ebook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to grep Twitter</title>
		<link>http://www.johndcook.com/blog/2009/03/12/grep-twitter-regex/</link>
		<comments>http://www.johndcook.com/blog/2009/03/12/grep-twitter-regex/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 13:46:51 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1733</guid>
		<description><![CDATA[Twitter has an extensive search API. To build the URL for a query, start with the base http://search.twitter.com/search.atom?q=. To search for a word, just append that word to the base, such as http://search.twitter.com/search.atom?q=Coltrane to search for tweets containing &#8220;Coltrane.&#8221;
To search for a term within a particular user&#8217;s tweet stream, start with the base URL and [...]]]></description>
			<content:encoded><![CDATA[<p>Twitter has an extensive <a href="http://apiwiki.twitter.com/Search+API+Documentation">search API</a>. To build the URL for a query, start with the base <code>http://search.twitter.com/search.atom?q=</code>. To search for a word, just append that word to the base, such as <code>http://search.twitter.com/search.atom?q=Coltrane</code> to search for tweets containing &#8220;Coltrane.&#8221;</p>
<p>To search for a term within a particular user&#8217;s tweet stream, start with the base URL and append <code>+from%3A</code> and the user&#8217;s name. (The <code>%3A</code> is a URL- encoded colon.) See the <a href="http://apiwiki.twitter.com/Search+API+Documentation">search API</a> page for other options, such as specifying the number of requests per page to return (look for <code>rpp</code>) or restricting the language (look for <code>lang</code>).</p>
<p>As far as I can tell, the API does not support regular expressions, but you could loop over the search results programmatically. Here&#8217;s how you&#8217;d do it in PowerShell.</p>
<p>First, grab the search results as a string. Say we want to search through the latest tweets from Hal Rottenberg, <a href="http://twitter.com/halr9000">@halr9000</a>.</p>
<pre>$base = "http://search.twitter.com/search.atom?q="
$query = "from%3Ahalr9000"
$str = (new-object net.webclient).DownloadString($base + $query)</pre>
<p>Now <code>$str</code> contains an XML string of results formatted as an Atom feed. The root element is <code>&lt;feed&gt;</code> and individual tweets are contained in <code>&lt;entry&gt;</code> tags under that. The text of the tweet is in the <code>&lt;title&gt;</code> tag and the other tags contain auxiliary data such as time stamps. The following code shows how to search for the regular expression <code>\d{4}</code>. (Look for four-digit numbers.)</p>
<pre>( $str).feed.entry | where-object {$_.title -match "\d{4}"}</pre>
<p>In English, the code says to cast <code>$str</code> to an XML document object and pipe the <code>&lt;entry&gt;</code> contents to the filter that selects those objects whose <code>&lt;title&gt;</code> strings match the regular expression.</p>
<p>The search API limits the number of entries it will return, so it&#8217;s best to do as much filtering as you can via the Twitter site before doing your own filtering.</p>
<p>Related posts:</p>
<p><a href="http://www.johndcook.com/blog/2008/10/07/regular-expressions-in-powershell-and-perl/">Regular expressions in PowerShell and Perl</a><br />
<a href="http://www.johndcook.com/blog/2008/10/17/table-driven-text-munging-powershell/">Table-driven text munging in PowerShell</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/03/12/grep-twitter-regex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free PowerShell eBook from Keith Hill</title>
		<link>http://www.johndcook.com/blog/2009/03/09/free-powershell-ebook-from-keith-hill/</link>
		<comments>http://www.johndcook.com/blog/2009/03/09/free-powershell-ebook-from-keith-hill/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 11:58:55 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1702</guid>
		<description><![CDATA[Keith Hill has turned his Effective PowerShell series of blog posts into a 50-page PDF. He just posted Effective Windows PowerShell yesterday.
]]></description>
			<content:encoded><![CDATA[<p>Keith Hill has turned his Effective PowerShell series of blog posts into a 50-page PDF. He just posted <a href="http://keithhill.spaces.live.com/blog/cns!5A8D2641E0963A97!6930.entry">Effective Windows PowerShell</a> yesterday.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/03/09/free-powershell-ebook-from-keith-hill/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DSLs in PowerShell</title>
		<link>http://www.johndcook.com/blog/2009/03/05/dsls-in-powershell/</link>
		<comments>http://www.johndcook.com/blog/2009/03/05/dsls-in-powershell/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 12:47:58 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1692</guid>
		<description><![CDATA[In an earlier post, I quoted John Lam saying that one reason Ruby is such a good language for implementing DSLs (domain specific languages) is that function calls do not require parentheses. This allows DSL authors to create functions that look like new keywords. I believe I heard Bruce Payette say in an interview that [...]]]></description>
			<content:encoded><![CDATA[<p>In an <a href="http://www.johndcook.com/blog/2009/03/04/why-ruby-is-a-good-language-for-dsls/">earlier post</a>, I quoted John Lam saying that one reason Ruby is such a good language for implementing DSLs (domain specific languages) is that function calls do not require parentheses. This allows DSL authors to create functions that look like new keywords. I believe I heard Bruce Payette say in an interview that Ruby had some influence on the design of PowerShell. Maybe Ruby influenced the PowerShell team&#8217;s decision to not use parentheses around function arguments. (A bigger factor was convenience at the command line and shell language tradition.)</p>
<p>In what ways has Ruby influenced PowerShell? And if Ruby is good for implementing DSLs, how good would PowerShell be?</p>
<p>Update: See Keith Hill&#8217;s blog post on <a href="http://keithhill.spaces.live.com/Blog/cns!5A8D2641E0963A97!6944.entry">PowerShell function names</a> and DSLs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/03/05/dsls-in-powershell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PowerShell A-Z series completed</title>
		<link>http://www.johndcook.com/blog/2009/02/10/powershell-a-z-series-completed/</link>
		<comments>http://www.johndcook.com/blog/2009/02/10/powershell-a-z-series-completed/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 16:53:19 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1487</guid>
		<description><![CDATA[Joe Pruitt has finished his PowerShell A-Z series.
]]></description>
			<content:encoded><![CDATA[<p>Joe Pruitt has finished his <a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/02/10/powershell-abcs---a-to-z.aspx">PowerShell A-Z series</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/02/10/powershell-a-z-series-completed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joe Pruitt&#8217;s PowerShell ABCs</title>
		<link>http://www.johndcook.com/blog/2009/01/13/joe-pruitts-powershell-abcs/</link>
		<comments>http://www.johndcook.com/blog/2009/01/13/joe-pruitts-powershell-abcs/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 12:07:37 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1255</guid>
		<description><![CDATA[I just ran across a nice series of PowerShell posts by Joe Pruitt called the &#8220;PowerShell ABC&#8217;s,&#8221; one post for each letter of the alphabet. He&#8217;s up to O so far.
Arithmetic operators
Begin
CmdLet
Debugging
Execution policy
Format operator
Generics
Here string
Is
JavaScript
Keywords
Location
Matching
Numbers
Output
]]></description>
			<content:encoded><![CDATA[<p>I just ran across a nice series of PowerShell posts by Joe Pruitt called the &#8220;PowerShell ABC&#8217;s,&#8221; one post for each letter of the alphabet. He&#8217;s up to O so far.</p>
<p><a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/12/powershell-abcs---a-is-for-arithmetic-operators.aspx">Arithmetic operators</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/15/powershell-abcs---b-is-for-begin.aspx">Begin</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/16/powershell-abcs---c-is-for-cmdlet.aspx">CmdLet</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/17/powershell-abcs---d-is-for-debugging.aspx">Debugging</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/18/powershell-abcs---e-is-for-executionpolicy.aspx">Execution policy</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/19/powershell-abcs---f-is-for-format-operator.aspx">Format operator</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/29/powershell-abcs---g-is-for-generics.aspx">Generics</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/30/powershell-abcs---h-is-for-here-string.aspx">Here string</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/12/31/powershell-abcs---i-is-for-is.aspx">Is</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/01/02/powershell-abcs---j-is-for-javascript.aspx">JavaScript</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/01/05/powershell-abcs---k-is-for-keywords.aspx">Keywords</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/01/06/powershell-abcs---l-is-for-location.aspx">Location</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/01/07/powershell-abcs---m-is-for-matching.aspx">Matching</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/01/08/powershell-abcs---n-is-for-numbers.aspx">Numbers</a><br />
<a href="http://devcentral.f5.com/weblogs/Joe/archive/2009/01/09/powershell-abcs---o-is-for-output.aspx">Output</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/01/13/joe-pruitts-powershell-abcs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Negative space in operating systems</title>
		<link>http://www.johndcook.com/blog/2008/12/23/negative-space-operating-systems/</link>
		<comments>http://www.johndcook.com/blog/2008/12/23/negative-space-operating-systems/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 14:12:04 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Creativity]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=527</guid>
		<description><![CDATA[Unix advocates often say Unix is great because it has all these powerful tools. And yet practically every Unix tool has been ported to Windows. So why not just run Unix tools on Windows so that you have access to both tool sets? Sounds reasonable, but hardly anyone does that. People either use Unix tools on Unix [...]]]></description>
			<content:encoded><![CDATA[<p>Unix advocates often say Unix is great because it has all these powerful tools. And yet practically every Unix tool has been ported to Windows. So why not just run Unix tools on Windows so that you have access to both tool sets? Sounds reasonable, but hardly anyone does that. People either use Unix tools on Unix or Windows tools on Windows.</p>
<p>Part of the reason is compatibility. Not <em>binary</em> compatibility, but <em>cultural</em> compatibility. There&#8217;s a mental tax for shifting modes of thinking as you switch tools.</p>
<p>I think the reason why few people use Unix tools on Windows is a sort of negative space. Artists use the term negative space to discuss the importance of what is <strong><em>not </em></strong>in a work of art, such as the white space around a figure or the silence framing a melody.</p>
<p>Similarly, part of what makes an operating system culture is what is <strong><em>not</em> </strong>there. You don&#8217;t have to worry about what&#8217;s not there. And not worrying about something frees up brain capacity to think about something else. Having too many options can be paralyzing. I think that even though people say they like Unix for what <strong><em>is</em></strong> there, they actually value what is <strong><em>not</em></strong> there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/12/23/negative-space-operating-systems/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>PowerShell version 2 timetable</title>
		<link>http://www.johndcook.com/blog/2008/11/06/powershell-version-2-timetable/</link>
		<comments>http://www.johndcook.com/blog/2008/11/06/powershell-version-2-timetable/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 21:42:19 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=807</guid>
		<description><![CDATA[Looks like it will be another year until PowerShell version 2 comes out. See Dmitry&#8217;s PowerBlog for details.
]]></description>
			<content:encoded><![CDATA[<p>Looks like it will be another year until PowerShell version 2 comes out. See <a href="http://feeds.feedburner.com/~r/DmitrysPowerblog/~3/444407341/">Dmitry&#8217;s PowerBlog</a> for details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/11/06/powershell-version-2-timetable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Table-driven text munging in PowerShell</title>
		<link>http://www.johndcook.com/blog/2008/10/17/table-driven-text-munging-powershell/</link>
		<comments>http://www.johndcook.com/blog/2008/10/17/table-driven-text-munging-powershell/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 22:27:52 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Regular expressions]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=675</guid>
		<description><![CDATA[In my previous post, I mentioned formatting C++ code as HTML by doing some regular expression substitutions. I often need to write something that carries out a list of pattern substitutions, so I decided to rewrite the previous script to read a list of patterns from a file. Another advantage of putting the list of [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.johndcook.com/blog/2008/10/17/manipulating-the-clipboard-with-powershell/">previous post</a>, I mentioned formatting C++ code as HTML by doing some regular expression substitutions. I often need to write something that carries out a list of pattern substitutions, so I decided to rewrite the previous script to read a list of patterns from a file. Another advantage of putting the list of substitutions in an external file is that the same file could be used from scripts written in other languages.</p>
<p>Here&#8217;s the code:</p>
<pre>param($regex_file)

$lines = get-content $regex_file

$a = get-clipboard

foreach( $line in $lines )
{
    $line = ($line.trim() -replace "\s+", " ")
    $pair = $line.split(" ", [StringSplitOptions]::RemoveEmptyEntries)
    $a = $a -replace $pair
}

out-clipboard $a</pre>
<p>The part of the script that is unique to formatting C++ as HTML is moved to a separate file, say <code>cpp2html.txt</code>, that is pass in as an argument to the script.</p>
<pre>&amp;  &amp;amp;
&lt;  &amp;lt;
&gt;  &amp;gt;
"  &amp;quot;
'  &amp;#39;</pre>
<p>Now I could use the same PowerShell script for any sort of task that boils down to a list of pattern replacements. (Often this kind of rough translation does not have to be done perfectly. It only has to be done well enough to reduce the amount of left over manual work to an acceptable level. You start with a small list of patterns and add more patterns until it&#8217;s less work to do the remaining work by hand than to make the script smarter.)</p>
<p>Note that the order of the lines in the file can be important. Substitutions are done from the top of the list down. In the example above, we want to first convert <code>&amp;</code> to <code>&amp;amp;</code> then convert <code>&lt;</code> to <code>&amp;lt;</code>. Otherwise, <code>&lt;</code> would first become <code>&amp;lt;</code> and then become <code>&amp;amp;lt;</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/10/17/table-driven-text-munging-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manipulating the clipboard with PowerShell</title>
		<link>http://www.johndcook.com/blog/2008/10/17/manipulating-the-clipboard-with-powershell/</link>
		<comments>http://www.johndcook.com/blog/2008/10/17/manipulating-the-clipboard-with-powershell/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 11:31:27 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=668</guid>
		<description><![CDATA[The PowerShell Community Extensions contain a couple handy cmdlets for working with the Windows clipboard: Get-Clipboard and Out-Clipboard. One way to use these cmdlets is to copy some text to the clipboard, munge it, and paste it somewhere else. This lets you avoid creating a temporary file just to run a script on it.
For example, [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.codeplex.com/PowerShellCX">PowerShell Community Extensions</a> contain a couple handy cmdlets for working with the Windows clipboard: <code>Get-Clipboard</code> and <code>Out-Clipboard</code>. One way to use these cmdlets is to copy some text to the clipboard, munge it, and paste it somewhere else. This lets you avoid creating a temporary file just to run a script on it.</p>
<p>For example, occasionally I need to copy some C++ source code and paste it into HTML in a <code>&lt;pre&gt;</code> block. While <code>&lt;pre&gt;</code> turns off normal HTML formatting, special characters still need to be escaped: <code>&lt;</code> and <code>&gt;</code> need to be turned into <code>&amp;lt;</code> and <code>&amp;gt;</code> etc. I can copy the code from Visual Studio, run a script <code>html.ps1</code> from PowerShell, and paste the code into my HTML editor. (I like to use <a href="http://www.microsoft.com/expression/products/overview.aspx?key=web">Expression Web</a>.)</p>
<p>The script <code>html.ps1</code> looks like this.</p>
<pre>$a = get-clipboard;
$a = $a -replace "&amp;", "&amp;amp;";
$a = $a -replace "&lt;", "&amp;lt;";
$a = $a -replace "&gt;", "&amp;gt;";
$a = $a -replace '"', "&amp;quot;"
$a = $a -replace "'", "&amp;#39;"
out-clipboard $a</pre>
<p>So this C++ code</p>
<pre>double&amp; x = y;
char c = 'k';
string foo = "hello";
if (p &lt; q) ...</pre>
<p>turns into this HTML code</p>
<pre>double&amp;amp; x = y;
char c = &amp;#39;k&amp;#39;;
string foo = &amp;quot;hello&amp;quot;;
if (p &amp;lt; q) ...</pre>
<p>Of course the PSCX clipboard cmdlets are useful for more than HTML encoding. For example, I wrote a <a href="http://www.johndcook.com/blog/2008/04/30/integrating-the-clipboard-and-the-command-line/">post</a> a few months ago about using them for a similar text manipulation problem.</p>
<p>If you&#8217;re going to do much text manipulation, you may may want to look at these notes on <a href="http://www.johndcook.com/regex.html">regular expressions in PowerShell</a>.</p>
<p>The only problem I&#8217;ve had with the PSCX clipboard cmdlets is copying formatted text. The cmdlets work as expected when copying plain text. But here&#8217;s what I got when I copied the word &#8220;snippets&#8221; from the CodeProject home page and ran <code>Get-Clipboard</code>:</p>
<pre>Version:0.9
StartHTML:00000136
EndHTML:00000214
StartFragment:00000170
EndFragment:00000178
SourceURL:http://www.codeproject.com/
&lt;html&gt;&lt;body&gt;
&lt;!--StartFragment--&gt;snippets&lt;!--EndFragment--&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>The <code>Get-Clipboard</code> cmdlet has a <code>-Text</code> option that you might think would copy content as text, but as far as I can tell the option does nothing. This may be addressed in a future release of PSCX; it has been assigned a <a href="http://www.codeplex.com/PowerShellCX/WorkItem/View.aspx?WorkItemId=16523">work item</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/10/17/manipulating-the-clipboard-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regular expressions in PowerShell and Perl</title>
		<link>http://www.johndcook.com/blog/2008/10/07/regular-expressions-in-powershell-and-perl/</link>
		<comments>http://www.johndcook.com/blog/2008/10/07/regular-expressions-in-powershell-and-perl/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 09:52:25 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Regular expressions]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=579</guid>
		<description><![CDATA[This is one of the most popular pages on my web site:
Regular expressions in PowerShell and Perl
It&#8217;s about how you use regular expressions in PowerShell — how to do matches, replacements, etc. — rather than the grammar of regular expressions. It makes comparisons to Perl, in case you&#8217;re already familiar with how to use regular [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of the most popular pages on my web site:</p>
<p><a href="http://www.johndcook.com/regex.html"><span>Regular expressions in <span>PowerShell</span> and Perl</span></a></p>
<p><span>It&#8217;s about how you use regular expressions in <span>PowerShell</span> — how to do matches, replacements, etc. — rather than the grammar of regular expressions. It makes comparisons to Perl, in case you&#8217;re already familiar with how to use regular expressions there.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/10/07/regular-expressions-in-powershell-and-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experimenting with Out-Speech in PowerShell</title>
		<link>http://www.johndcook.com/blog/2008/10/03/experimenting-with-out-speech-in-powershell/</link>
		<comments>http://www.johndcook.com/blog/2008/10/03/experimenting-with-out-speech-in-powershell/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 07:29:52 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=507</guid>
		<description><![CDATA[I&#8217;ve played around with the PSCX script Out-Speech at home and at work. At home, running Vista, words come out in a natural female voice. At work, running XP, words come out in a robotic male voice.
The voice is somewhat configurable. I didn&#8217;t try it at home, but at work I opened the Speech Properties applet [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve played around with the <a href="http://www.codeplex.com/PowerShellCX">PSCX</a> script <code>Out-Speech</code> at home and at work. At home, running Vista, words come out in a natural female voice. At work, running XP, words come out in a robotic male voice.</p>
<p>The voice is somewhat configurable. I didn&#8217;t try it at home, but at work I opened the Speech Properties applet in the control panel. All three are mechanical voices. I went to Microsoft&#8217;s web site to see if I could download a natural voice. The site said that Microsoft does not provide other voices but it gives a link to third party providers.</p>
<p>My guess is that Microsoft deliberately put lame voices in XP for fear of a lawsuit and that they were braver by the time Vista was released.</p>
<p>Another difference I noticed between Vista and XP is tolerance of misspellings. XP will correctly pronounce &#8220;Fahrenheit&#8221; but pronounces the incorrect &#8220;Farenheit&#8221; so that it rhymes with &#8220;heat&#8221; rather than &#8220;height&#8221;. Vista correctly pronounces the misspelled word.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/10/03/experimenting-with-out-speech-in-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Depend on objects, not their presentation</title>
		<link>http://www.johndcook.com/blog/2008/09/04/depend-on-objects-not-their-presentation/</link>
		<comments>http://www.johndcook.com/blog/2008/09/04/depend-on-objects-not-their-presentation/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 11:12:30 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=356</guid>
		<description><![CDATA[The most recent blog post by Jeffrey Snover emphasizes that PowerShell pipes objects, not text. When you use single PowerShell commands, you can get the impression that they output text.  But everything is an object until the pipeline spills onto the command line.
In UNIX, text output is effectively a programming contract because that is what [...]]]></description>
			<content:encoded><![CDATA[<p>The most recent <a href="http://blogs.msdn.com/powershell/archive/2008/09/04/text-output-is-not-a-contract.aspx">blog post by Jeffrey Snover</a> emphasizes that PowerShell pipes objects, not text. When you use single PowerShell commands, you can get the impression that they output text.  But everything is an object until the pipeline spills onto the command line.</p>
<blockquote><p>In UNIX, text output is effectively a programming contract because that is what the whole system is built upon.  One command outputs text and other programs know what to expect so they parse the text to get the appropriate data elements so that they can code against it.  In this model, if you change the text output of a command &#8211; you run the risk of breaking a bunch of scripts.  &#8230; In PowerShell &#8230; <strong>We reserve the right to radically change our text rendering to improve our customer experience.</strong></p></blockquote>
<p>(Emphasis in the original.)</p>
<p>The object interfaces won&#8217;t change, but the text rendering probably will.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/09/04/depend-on-objects-not-their-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell posts classified</title>
		<link>http://www.johndcook.com/blog/2008/08/27/powershell-posts-classified/</link>
		<comments>http://www.johndcook.com/blog/2008/08/27/powershell-posts-classified/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 00:09:03 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/08/27/powershell-posts-classified/</guid>
		<description><![CDATA[Here&#8217;s a summary of the blog posts I&#8217;ve written so far regarding PowerShell, grouped by topic.
Three posts announced CodeProject articles related to PowerShell:  automated software builds, text reviews for software, and monitoring legacy code.
Three posts on customizing the command prompt: I, II, III.
Two posts on XML sitemaps: making a sitemap and filtering a sitemap.
Two Unix-related [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a summary of the blog posts I&#8217;ve written so far regarding PowerShell, grouped by topic.</p>
<p>Three posts announced <strong>CodeProject articles</strong> related to PowerShell:  <a href="http://www.johndcook.com/blog/2008/04/20/automated-software-builds/">automated software builds</a>, <a href="http://www.johndcook.com/blog/2008/04/11/text-reviews-for-software/">text reviews for software</a>, and <a href="http://www.johndcook.com/blog/2008/06/24/monitoring-legacy-code-that-fails-silently/">monitoring legacy code</a>.</p>
<p>Three posts on <strong>customizing the command prompt</strong>: <a href="http://www.johndcook.com/blog/2008/05/12/customizing-the-powershell-command-prompt/">I</a>, <a href="http://www.johndcook.com/blog/2008/05/13/customizing-the-powershell-command-prompt-ii/">II</a>, <a href="http://www.johndcook.com/blog/2008/08/17/improved-powershell-prompt/">III</a>.</p>
<p>Two posts on <strong>XML sitemaps</strong>: <a href="http://www.johndcook.com/blog/2008/05/27/powershell-script-to-make-an-xml-sitemap/">making a sitemap</a> and <a href="http://www.johndcook.com/blog/2008/08/01/powershell-one-liner-to-filter-a-sitemap/">filtering a sitemap</a>.</p>
<p>Two <strong>Unix-related</strong> posts: <a href="http://www.johndcook.com/blog/2008/04/18/cross-platform-powershell/">cross-platform PowerShell</a> and <a href="http://www.johndcook.com/blog/2008/07/08/comparing-powershell-and-bash/">comparing PowerShell and bash</a>.</p>
<p>The rest of the PowerShell posts I&#8217;ve written so far fall under <strong>miscellaneous</strong>.</p>
<p><a href="http://www.johndcook.com/blog/2008/05/02/top-five-gotchas-when-learning-powershell/">gotchas</a><br />
<a href="http://www.johndcook.com/blog/2008/07/31/polymon-system-monitoring-software/">PolyMon</a><br />
<a href="http://www.johndcook.com/blog/2008/01/22/c-verbatim-strings-vs-powershell-here-strings/">here-strings</a><br />
<a href="http://www.johndcook.com/blog/2008/05/01/readable-path-listings/">readable paths</a><br />
<a href="http://www.johndcook.com/blog/2008/05/24/uninitialized-variables-in-powershell/">uninitialized variables</a><br />
<a href="http://www.johndcook.com/blog/2008/07/17/writing-aspnet-pages-in-powershell/">ASP.NET in PowerShell</a><br />
<a href="http://www.johndcook.com/blog/2008/04/30/integrating-the-clipboard-and-the-command-line/">clipboard and command line</a><br />
<a href="http://www.johndcook.com/blog/2008/07/11/launch-powershell-6x-faster/">launching PowerShell faster</a><br />
<a href="http://www.johndcook.com/blog/2008/05/19/rounding-and-integer-division-in-powershell/">rounding and integer division</a><br />
<a href="http://www.johndcook.com/blog/2008/04/27/one-program-to-rule-them-all/">one program to rule them all</a><a href="http://www.johndcook.com/blog/2008/05/24/uninitialized-variables-in-powershell/"><br />
</a><a href="http://www.johndcook.com/blog/2008/08/25/powershell-output-redirection-unicode-or-ascii/">redirection and Unicode vs ASCII</a></p>
<p>Much to my surprise, the post on integer division in PowerShell has been one of the most popular.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/08/27/powershell-posts-classified/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell output redirection: Unicode or ASCII?</title>
		<link>http://www.johndcook.com/blog/2008/08/25/powershell-output-redirection-unicode-or-ascii/</link>
		<comments>http://www.johndcook.com/blog/2008/08/25/powershell-output-redirection-unicode-or-ascii/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 22:10:46 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/08/25/powershell-output-redirection-unicode-or-ascii/</guid>
		<description><![CDATA[What does the redirection operator &#62; in PowerShell do to text: leave it as Unicode or convert it to ASCII? The answer depends on whether the thing to the right of the &#62; operator is a file or a program.
Strings inside PowerShell are 16-bit Unicode, instances of .NET&#8217;s System.String class. When you redirect the output [...]]]></description>
			<content:encoded><![CDATA[<p>What does the redirection operator &gt; in PowerShell do to text: leave it as Unicode or convert it to ASCII? The answer depends on whether the thing to the right of the <code>&gt;</code> operator is a file or a program.</p>
<p>Strings inside PowerShell are 16-bit Unicode, instances of .NET&#8217;s <code>System.String</code> class. When you redirect the output to a file, the file receives Unicode text. As Bruce Payette says in his book <a href="http://www.amazon.com/gp/product/1932394907/102-9540266-7906549?ie=UTF8&amp;tag=theende-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=1932394907">Windows PowerShell in Action</a>,</p>
<blockquote><p><code>myScript &gt; file.txt</code> is just <em>syntactic sugar</em> for <code>myScript | out-file -path file.txt</code></p></blockquote>
<p>and <code>out-file</code> defaults to Unicode. The advantage of explicitly using <code>out-file</code> is that you can then specify the output format using the <code>-encoding</code> parameter. Possible encoding values include Unicode, UTF8, ASCII, and others.</p>
<p>If the thing on the right side of the redirection operator is a program rather than a file, the encoding is determined by the variable <code>$OutputEncoding</code>. This variable defaults to ASCII encoding because most existing applications do not handle Unicode correctly. However, you can set this variable so PowerShell sends applications Unicode. See Jeffrey Snover&#8217;s blog post <a href="http://blogs.msdn.com/powershell/archive/2006/12/11/outputencoding-to-the-rescue.aspx">OuputEncoding to the rescue</a> for details.</p>
<p>Of course if you&#8217;re passing strings between pieces of PowerShell code, everything says in Unicode.</p>
<p>Thanks to J_Tom_Moon_79 for suggesting a blog post on this topic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/08/25/powershell-output-redirection-unicode-or-ascii/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Improved PowerShell prompt</title>
		<link>http://www.johndcook.com/blog/2008/08/17/improved-powershell-prompt/</link>
		<comments>http://www.johndcook.com/blog/2008/08/17/improved-powershell-prompt/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 11:12:54 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/08/17/improved-powershell-prompt/</guid>
		<description><![CDATA[A while back I wrote a post on how to customize your PowerShell prompt. Last week Tomas Restrepo posted an article on a PowerShell prompt that adds color and shortens the path in a more subtle way. I haven&#8217;t tried it out yet, but his prompt looks much better than what I&#8217;ve been using.
If you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I wrote a post on <a href="http://www.johndcook.com/blog/2008/05/12/customizing-the-powershell-command-prompt/">how to customize your PowerShell prompt</a>. Last week Tomas Restrepo posted an <a href="http://www.winterdom.com/weblog/2008/08/14/MyPowerShellPrompt.aspx">article</a> on a PowerShell prompt that adds color and shortens the path in a more subtle way. I haven&#8217;t tried it out yet, but his prompt looks much better than what I&#8217;ve been using.</p>
<p>If you&#8217;re a long-time Windows user you might be worried that all this PowerShell stuff is starting to look a lot like Unix. Well, it is. Some of the folks on the <a href="http://blogs.msdn.com/powershell/">PowerShell team</a> have a Unix background and they&#8217;re bringing some of the best of Unix to Windows. The Unix world has more experience operating from the command line and so it&#8217;s wise to learn from them.</p>
<p>On the other hand, PowerShell is emphatically not bash for Windows. PowerShell is thoroughly object oriented and in that respect unlike any Unix shell. Also, PowerShell is strongly tied to Microsoft libraries, particularly .NET but also COM and WMI.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/08/17/improved-powershell-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell one-liner to filter a sitemap</title>
		<link>http://www.johndcook.com/blog/2008/08/01/powershell-one-liner-to-filter-a-sitemap/</link>
		<comments>http://www.johndcook.com/blog/2008/08/01/powershell-one-liner-to-filter-a-sitemap/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 15:11:46 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Sitemap]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/08/01/powershell-one-liner-to-filter-a-sitemap/</guid>
		<description><![CDATA[Suppose you have an XML sitemap and you want to extract a flat list of URLs. This PowerShell code will do the trick.
        ( (gc sitemap.xml)).urlset.url &#124; % {$_.loc}
This code calls Get-Content, using the shortcut gc, to read the file sitemap.xml and casts the file to an XML document [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you have an <a href="http://www.sitemaps.org/protocol.php">XML sitemap</a> and you want to extract a flat list of URLs. This PowerShell code will do the trick.</p>
<pre>        ( (gc sitemap.xml)).urlset.url | % {$_.loc}</pre>
<p>This code calls <code>Get-Content</code>, using the shortcut <code>gc</code>, to read the file <code>sitemap.xml</code> and casts the file to an XML document object. It then makes an array of all blocks of XML inside a <code>&lt;url&gt;</code> tag. It then pipes the array to the <code>foreach</code> command, using the shortcut <code>%</code>, and selects the content of the <code>&lt;loc&gt;</code> tag which is the actual URL.</p>
<p>Now if you want to filter the list further, say to pull out all the PDF files, you can pipe the previous output to a <code>Where-Object</code> filter.</p>
<pre>        ( (gc sitemap.xml)).urlset.url | % {$_.loc} |
        ? {$_ -like *.pdf}</pre>
<p>This code uses the <code>?</code> shortcut for the <code>Where-Object</code> command. The <code>-like</code> filter uses command line style matching. You could use <code>-match</code> to filter on a regular expression.</p>
<p>Related resources: <a href="http://www.johndcook.com/blog/2008/05/27/powershell-script-to-make-an-xml-sitemap/">PowerShell script to make an XML sitemap</a>, <a href="http://www.johndcook.com/regex.html">Regular expressions in PowerShell </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/08/01/powershell-one-liner-to-filter-a-sitemap/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PolyMon system monitoring software</title>
		<link>http://www.johndcook.com/blog/2008/07/31/polymon-system-monitoring-software/</link>
		<comments>http://www.johndcook.com/blog/2008/07/31/polymon-system-monitoring-software/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 02:06:05 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/07/31/polymon-system-monitoring-software/</guid>
		<description><![CDATA[I just heard about PolyMon this evening. It&#8217;s an open source system monitoring project. It can monitor servers, system logs, etc. Users can create custom monitors via PowerShell scripts. Sounds like its worth further investigation.
]]></description>
			<content:encoded><![CDATA[<p>I just heard about <a href="http://www.codeplex.com/polymon">PolyMon</a> this evening. It&#8217;s an open source system monitoring project. It can monitor servers, system logs, etc. Users can create custom monitors via PowerShell scripts. Sounds like its worth further investigation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/07/31/polymon-system-monitoring-software/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Writing ASP.NET pages in PowerShell</title>
		<link>http://www.johndcook.com/blog/2008/07/17/writing-aspnet-pages-in-powershell/</link>
		<comments>http://www.johndcook.com/blog/2008/07/17/writing-aspnet-pages-in-powershell/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 15:28:35 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/07/17/writing-aspnet-pages-in-powershell/</guid>
		<description><![CDATA[Steve at PowerShell Basics wrote a post about how to write ASP pages using PowerShell.
]]></description>
			<content:encoded><![CDATA[<p>Steve at <a href="http://powershell-basics.com/">PowerShell Basics</a> wrote a <a href="http://powershell-basics.com/2008/07/16/using-powershellasp/">post</a> about how to write <a href="http://powershelltoys.com/">ASP pages using PowerShell</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/07/17/writing-aspnet-pages-in-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Launch PowerShell 6x faster</title>
		<link>http://www.johndcook.com/blog/2008/07/11/launch-powershell-6x-faster/</link>
		<comments>http://www.johndcook.com/blog/2008/07/11/launch-powershell-6x-faster/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 18:55:10 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/07/11/launch-powershell-6x-faster/</guid>
		<description><![CDATA[In the latest Windows PowerShell blog post Jeffrey Snover points to an earlier post he wrote about how to make PowerShell launch much faster. On my desktop, the time to launch PowerShell went from around 13 seconds to around 2 seconds after applying the fix Snover recommends.
]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://blogs.msdn.com/powershell/archive/2008/07/11/speeding-up-powershell-startup.aspx">latest</a> Windows PowerShell blog post Jeffrey Snover points to an <a href="http://blogs.msdn.com/powershell/archive/2007/11/08/update-gac-ps1.aspx">earlier</a> post he wrote about how to make PowerShell launch much faster. On my desktop, the time to launch PowerShell went from around 13 seconds to around 2 seconds after applying the fix Snover recommends.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/07/11/launch-powershell-6x-faster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comparing PowerShell and Bash</title>
		<link>http://www.johndcook.com/blog/2008/07/08/comparing-powershell-and-bash/</link>
		<comments>http://www.johndcook.com/blog/2008/07/08/comparing-powershell-and-bash/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 13:28:18 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/07/08/comparing-powershell-and-bash/</guid>
		<description><![CDATA[On the Windows PowerShell blog, Jeffrey Snover links to a article in Linux Magazine by Narcus Nasarek comparing Windows PowerShell and Linux&#8217;s bash shell.
The article&#8217;s sequence is unexpected. Not until near the end of the article does Nasarek get to the main difference between PowerShell and bash: PowerShell pipes objects, not text. Nasarek says regarding [...]]]></description>
			<content:encoded><![CDATA[<p>On the <a href="http://blogs.msdn.com/powershell/archive/2008/07/08/bash-vs-powershell.aspx">Windows PowerShell blog</a>, Jeffrey Snover links to a article in <a href="http://w3.linux-magazine.com/issue/78/Bash_vs._Vista_PowerShell.pdf">Linux Magazine</a> by Narcus Nasarek comparing Windows PowerShell and Linux&#8217;s bash shell.</p>
<p>The article&#8217;s sequence is unexpected. Not until near the end of the article does Nasarek get to the main difference between PowerShell and bash: <strong>PowerShell pipes objects, not text</strong>. Nasarek says regarding PowerShell&#8217;s object pipeline &#8220;Bash cannot compete here.&#8221; He says that the disadvantage of bash in this regard is that &#8220;it relies on the abilities of external programs to handle data structures.&#8221; That is an understatement. The disadvantage of bash is that it requires fragile, ad hoc text manipulation to pluck data out of the pipeline.</p>
<p>Nasarek is being fair to PowerShell, but he was limited by space. He had only two pages for his article, and only about half of those two pages were devoted to text.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/07/08/comparing-powershell-and-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.997 seconds -->
