<?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>ps1.soapyfrog.com &#187; Cmdlets</title>
	<atom:link href="http://ps1.soapyfrog.com/category/cmdlets/feed/" rel="self" type="application/rss+xml" />
	<link>http://ps1.soapyfrog.com</link>
	<description>doing inappropriate things with powershell</description>
	<lastBuildDate>Sun, 26 Aug 2007 22:01:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Cmdlet clashes</title>
		<link>http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/</link>
		<comments>http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 09:56:22 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Cmdlets]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[Hint]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/</guid>
		<description><![CDATA[One of the things that struck me whilst developing Grrr as a snapin is: what do you do when you have a cmdlet with the same verb-noun pair as an existing cmdlet? If someone else had a cmdlet called, say, out-banner, and that cmdlet was already loaded in a snap-in (perhaps mandated by site policy), [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that struck me whilst developing <a href="/category/grrr/">Grrr</a> as a snapin is: what do you do when you have a cmdlet with the same verb-noun pair as an existing cmdlet?</p>
<p>If someone else had a cmdlet called, say, <code>out-banner</code>, and that cmdlet was already loaded in a snap-in (perhaps mandated by site policy), would I be able to register and add the Grrr snapin, which also defines it?</p>
<p>I&#8217;ve scanned the available documentation and the language grammar, used introspection in the shell and so on, but could not find anything to deal with this problem.</p>
<p>With projects like <a href="http://www.codeplex.com/PowerShellCX">PowerShell Community Extensions</a> seemingly laying claim to hundreds of common nouns and verbs, I was concerned that the scope for writing unique cmdlets would dry up real fast.</p>
<p><span id="more-62"></span></p>
<p>To determine what would happen, I <a href="/2007/02/26/grrr-11-and-big-invaders/">registered and added</a> <code>Soapyfrog.Grrr</code>, then wrote a new snapin, <code>Soapyfrog.Conflict</code>, with a single cmdlet, <code>out-banner</code>, conflicting with the one in Grrr.</p>
<p>I registered and added this, and was surprised that no warning of a conflict was given. To see if both were added, I tried this:</p>
<pre style='color: #000; background-color: #ccc; '>PS&gt; get-command out-banner

CommandType     Name                        Definition
-----------     ----                        ----------
Cmdlet          Out-Banner                  Out-Banner [-Text] <span>&lt;</span>Str...
Cmdlet          Out-Banner                  Out-Banner [-Text] <span>&lt;</span>Str...
</pre>
<p>Interesting. Both are available, so what happens when I try to invoke it?</p>
<pre style='color: #000; background-color: #ccc; '>PS&gt; out-banner hello
<span style='color: #800; background-color: #ccc'>The term &#39;out-banner&#39; resolved to a cmdlet name that is ambiguous. Pos</span>
<span style='color: #800; background-color: #ccc'>sible matches include: Soapyfrog.Grrr&#x5c;Out-Banner soapyfrog.conflict&#x5c;Ou</span>
<span style='color: #800; background-color: #ccc'>t-Banner.</span>
<span style='color: #800; background-color: #ccc'>At line:1 char:11</span>
<span style='color: #800; background-color: #ccc'>+ out-banner  <span>&lt;</span><span>&lt;</span><span>&lt;</span><span>&lt;</span> hello</span>
</pre>
<p>OK, so at this point, we know it&#8217;s possible to break existing PowerShell scripts by simply registering and adding a new snapin with a same-named cmdlet. Not good. Is there a work-around?</p>
<pre style='color: #000; background-color: #ccc; '>PS&gt; Soapyfrog.Grrr&#x5c;out-banner hello -fg &#39;o&#39;
o   o ooooo o     o      ooo
o   o o     o     o     o   o
ooooo ooo   o     o     o   o
o   o o     o     o     o   o
o   o ooooo ooooo ooooo  ooo
</pre>
<p>Yes! We can fully qualify the cmdlet name with the snapin name and a backslash.</p>
<p>So, it&#8217;s not as bad as I first feared, but as I noted above, you need to be very careful about how you code and run scripts in environments where you can&#8217;t predict what snapins are registered and installed.</p>
<p>I suppose you can create the correct shell environment with Export-Console and run your script with:  </p>
<p><code>powershell -psconsolefile xxx.psc1 -noprofile -command myscript.ps1</code></p>
<p>Or if your script requires a snapin, add the snapin in the script and fully qualify each cmdlet you use.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Grrr 1.1 and Big Invaders</title>
		<link>http://ps1.soapyfrog.com/2007/02/26/grrr-11-and-big-invaders/</link>
		<comments>http://ps1.soapyfrog.com/2007/02/26/grrr-11-and-big-invaders/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 16:29:41 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Announce]]></category>
		<category><![CDATA[Cmdlets]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[Invaders]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/02/22/grrr-11-and-big-invaders/</guid>
		<description><![CDATA[So I&#8217;ve been spending a bit of time getting to grips with Cmdlets and resurrecting interest in PSInvaders using Grrr and now have something to post. Grrr 1.1 is now Cmdlet based and comes as a Snap-In. The most obvious benefit from this is performance, as I can now present a playable version of PowerShell [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been spending a bit of time getting to grips with Cmdlets and resurrecting interest in <a href="http://ps1.soapyfrog.com/2007/01/02/space-invaders/">PSInvaders</a> using <strong>Grrr</strong> and now have something to post.</p>
<p><strong>Grrr 1.1</strong> is now Cmdlet based and comes as a Snap-In. The most obvious benefit from this is performance, as I can now present a playable version of <strong>PowerShell Big Invaders</strong>.</p>
<p><a href='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-inplay.gif' title='BigInvaders 1.1 in play'><img src='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-inplay-smooth.jpg' alt='BigInvaders 1.1 in play' /></a></p>
<p>BigInvaders is one of the demo PowerShell scripts that makes use of the Grrr.</p>
<p><strong><a href="http://ps1.soapyfrog.com/downloads/grrr-release-1.1.zip">Download this prerelease version 1.1 of the Grrr snap-in.</a></strong></p>
<p><em>Update: this should now install on Vista &#8211; thanks to Chris Warwick for pointing out some issues</em></p>
<p>There&#8217;s no installer (yet) so to get going, follow this instructions:</p>
<p>Unzip the archive where you want to use it and CD to the top level director where the README file is.</p>
<p>Type: <code>./installgrrr.ps1 -r</code></p>
<p>The <code>-r</code> switch forces it to re-register the snap-in if a (possibly) older version exists. It then adds the snap-in to the current shell.</p>
<p>From here you can CD into the <code>demos</code> directory and run any of the scripts. Each one shows a feature of Grrr, but perhaps the most interesting is in the <code>biginvaders</code> directory.</p>
<p>To run BigInvaders, you need to have a very large console. To achieve this you probably need to set the font size of your console window to 6&#215;8.</p>
<p>If you want sound, you need to install <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=2DA43D38-DB71-4C1B-BC6A-9B6652CD92A3&#038;displaylang=en">DirectX DirectSound</a>. More on why later.</p>
<p>It should work without, silently, but this hasn&#8217;t had much testing as all my XP boxes have it installed <img src='http://ps1.soapyfrog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  If there are exceptions, start it with the <code>-nosound</code> switch.</p>
<p>Assuming all is well, type <code>./biginvaders.ps1</code> and you should see this title screen:</p>
<p><a href='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-intro.gif' title='BigInvaders 1.1 intro screen'><img src='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-intro.thumbnail.gif' alt='BigInvaders 1.1 intro screen' /></a></p>
<p>Hit ESC to quit or Space to play. In play, Space fires a missile and arrow keys move left and right. Hit F to toggle FPS display in the top-righthand corner. </p>
<p>The target FPS is 33. I achieve this easily on my MacPro, and my wife&#8217;s Dell (a core 1 duo, 1.66ghz) also just manages.</p>
<p>There are still a few snags to iron out here and I want to add proper PowerShell help and an installer, but it is functional.</p>
<p>I&#8217;ve learned a lot about C#, PowerShell SDK and .NET these last weeks and will write about my findings over the next days. It&#8217;s not all been rosy.</p>
<p>I&#8217;ll also be writing about the features of <strong>Grrr</strong>, and where I want to go with it.</p>
<p>That&#8217;s it for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/02/26/grrr-11-and-big-invaders/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

