<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>VibrantCode - PowerKit</title>
    <link>http://blog.andrewnurse.net/</link>
    <description>Oooh...pretty code</description>
    <language>en-us</language>
    <copyright>Andrew Nurse</copyright>
    <lastBuildDate>Mon, 09 Feb 2009 22:15:01 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>andrew@andrewnurse.net</managingEditor>
    <webMaster>andrew@andrewnurse.net</webMaster>
    <item>
      <trackback:ping>http://blog.andrewnurse.net/Trackback.aspx?guid=ebff3ae0-84fe-4a4e-9dd8-531c9c469dee</trackback:ping>
      <pingback:server>http://blog.andrewnurse.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.andrewnurse.net/PermaLink,guid,ebff3ae0-84fe-4a4e-9dd8-531c9c469dee.aspx</pingback:target>
      <dc:creator>Andrew Nurse</dc:creator>
      <wfw:comment>http://blog.andrewnurse.net/CommentView,guid,ebff3ae0-84fe-4a4e-9dd8-531c9c469dee.aspx</wfw:comment>
      <wfw:commentRss>http://blog.andrewnurse.net/SyndicationService.asmx/GetEntryCommentsRss?guid=ebff3ae0-84fe-4a4e-9dd8-531c9c469dee</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>UPDATE 2: PowerKits requires PowerShell 2.0.  If you’re seeing errors
regarding the “try-catch” keywords, its because those keywords were added in PowerShell
2.0 and I use them in PowerKits.  Sorry!</strong>
        </p>
        <p>
          <strong>UPDATE: It turns out PowerShell 2.0 already contains a feature like this:
“Modules.”  See </strong>
          <a href="http://huddledmasses.org/powershell-modules/" target="_blank">
            <strong>here</strong>
          </a>
          <strong> for
more info.  Since it seems to be far superior to PowerKit (which I just hacked
together for my own needs), I guess that just leaves this as an interesting exercise
:).</strong>
        </p>
        <p>
I’ve been a huge fan of Windows PowerShell since it first came out as “Monad” (aka
“MSH”).  Now that its entering version 2.0, which will be built-in to Windows
7 and Windows Server 2008, I’m getting even more into it.  I’ve written a Podcast
Receiver (PowerCast) and an automated process for converting videos for use on my
Xbox 360 (PowerCode).
</p>
        <p>
[The following paragraph is a short intro to PowerShell, feel free to skip it if you’re
familiar with PoSH]
</p>
        <p>
What is PowerShell?  PowerShell is an object-oriented shell which, IMHO, kicks
the pants off of BASH and Perl.  PowerShell is a dynamically-typed scripting
language written on the .Net Framework, which gives you full access to every class,
method, and property in the framework.  You could write a GUI, Server, heck even
a 3D Game in PowerShell (it just might not perform as well as another language). 
PowerShell is also an interactive “Read-Eval-Print” loop application which gives you
a prompt into which you type commands which are then evaluated and their results printed
to the screen (i.e. a standard “Shell” similar to cmd.exe or BASH).  Finally,
PowerShell is an embeddable scripting environment which lets any .Net-based application
embed the PowerShell scripting language.  However, most people (myself included)
are referring to the Shell itself when they talk about PowerShell
</p>
        <p>
Anyway, on to the main purpose of this post.  I started to get frustrated with
trying to manage all my scripts and keep them organized.  I was also downloading
a lot of useful scripts off of the web, but had to manually place them somewhere in
my file-system (let alone managing all the dependencies).  Other scripting environments,
such as Ruby, have packaging systems, such as RubyGems, to manage libraries of functionality
and publish them for others to download.  So, I thought, why doesn’t PowerShell
have something like this?
</p>
        <p>
Thus, PowerKits were born.  The concept is simple.  A PowerKit is a directory
on your file-system which contains a manifest file “Kit.xml”.  This file specifies
some information such as the paths to various script files, aliases to create, .Net
assemblies to load and (in a future version) PowerShell “snap-ins” to load. 
After installing a kit (by placing it in one of many, configurable, pre-defined folders),
it can simply be enabled using a single PowerShell Command.  For example, to
enable the “MyCompany.MyKit” PowerKit:
</p>
        <pre class="code">Enable-Kit MyCompany.MyKit</pre>
        <p>
Enabling a kit loads all the assemblies, script files, etc. into your PowerShell environment,
making them available for use.  A Kit can then be disabled similarly using the
”Disable-Kit” command.  Disabling the kit removes all the script files, etc.
from the environment (NOTE: .Net assemblies cannot be unloaded without restarting
PowerShell, due to a limitation of the .Net Framework).
</p>
        <p>
PowerKit also supports packaging kits into a ZIP-like format, specifically the <a href="http://en.wikipedia.org/wiki/Open_Packaging_Convention" target="_blank">Open
Packaging Convention</a> developed by Microsoft for Office 2007 (since the .Net framework
has built-in support for that format). These “Kit Archives” can be downloaded and
installed using a single command.  Eventually, I plan to add support for installing
a kit directly from the web, so you could use a command like this:
</p>
        <pre class="code">Install-Kit <a href="http://www.mycompany.com/MyCompany.MyKit.kit">http://www.mycompany.com/MyCompany.MyKit.kit</a></pre>
        <p>
Or even this:
</p>
        <pre class="code">Install-Kit MyCompany.MyKit</pre>
        <p>
And the framework would go out and download the kit and install it, giving PowerShell
a true “gems-esque” packaging system.
</p>
        <p>
To install PowerKit, download the Install-PowerKit.ps1 script from the <a href="http://www.codeplex.com/powerkits" target="_blank">CodePlex
site</a>, more installation details are in the release notes on that page.
</p>
        <img width="0" height="0" src="http://blog.andrewnurse.net/aggbug.ashx?id=ebff3ae0-84fe-4a4e-9dd8-531c9c469dee" />
      </body>
      <title>Get-PowerKit: A PowerShell Packaging System</title>
      <guid isPermaLink="false">http://blog.andrewnurse.net/PermaLink,guid,ebff3ae0-84fe-4a4e-9dd8-531c9c469dee.aspx</guid>
      <link>http://blog.andrewnurse.net/2009/02/09/GetPowerKitAPowerShellPackagingSystem.aspx</link>
      <pubDate>Mon, 09 Feb 2009 22:15:01 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;UPDATE 2: PowerKits requires PowerShell 2.0.&amp;#160; If you’re seeing errors
regarding the “try-catch” keywords, its because those keywords were added in PowerShell
2.0 and I use them in PowerKits.&amp;#160; Sorry!&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;UPDATE: It turns out PowerShell 2.0 already contains a feature like this:
“Modules.”&amp;#160; See &lt;/strong&gt;&lt;a href="http://huddledmasses.org/powershell-modules/" target="_blank"&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; for
more info.&amp;#160; Since it seems to be far superior to PowerKit (which I just hacked
together for my own needs), I guess that just leaves this as an interesting exercise
:).&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I’ve been a huge fan of Windows PowerShell since it first came out as “Monad” (aka
“MSH”).&amp;#160; Now that its entering version 2.0, which will be built-in to Windows
7 and Windows Server 2008, I’m getting even more into it.&amp;#160; I’ve written a Podcast
Receiver (PowerCast) and an automated process for converting videos for use on my
Xbox 360 (PowerCode).
&lt;/p&gt;
&lt;p&gt;
[The following paragraph is a short intro to PowerShell, feel free to skip it if you’re
familiar with PoSH]
&lt;/p&gt;
&lt;p&gt;
What is PowerShell?&amp;#160; PowerShell is an object-oriented shell which, IMHO, kicks
the pants off of BASH and Perl.&amp;#160; PowerShell is a dynamically-typed scripting
language written on the .Net Framework, which gives you full access to every class,
method, and property in the framework.&amp;#160; You could write a GUI, Server, heck even
a 3D Game in PowerShell (it just might not perform as well as another language).&amp;#160;
PowerShell is also an interactive “Read-Eval-Print” loop application which gives you
a prompt into which you type commands which are then evaluated and their results printed
to the screen (i.e. a standard “Shell” similar to cmd.exe or BASH).&amp;#160; Finally,
PowerShell is an embeddable scripting environment which lets any .Net-based application
embed the PowerShell scripting language.&amp;#160; However, most people (myself included)
are referring to the Shell itself when they talk about PowerShell
&lt;/p&gt;
&lt;p&gt;
Anyway, on to the main purpose of this post.&amp;#160; I started to get frustrated with
trying to manage all my scripts and keep them organized.&amp;#160; I was also downloading
a lot of useful scripts off of the web, but had to manually place them somewhere in
my file-system (let alone managing all the dependencies).&amp;#160; Other scripting environments,
such as Ruby, have packaging systems, such as RubyGems, to manage libraries of functionality
and publish them for others to download.&amp;#160; So, I thought, why doesn’t PowerShell
have something like this?
&lt;/p&gt;
&lt;p&gt;
Thus, PowerKits were born.&amp;#160; The concept is simple.&amp;#160; A PowerKit is a directory
on your file-system which contains a manifest file “Kit.xml”.&amp;#160; This file specifies
some information such as the paths to various script files, aliases to create, .Net
assemblies to load and (in a future version) PowerShell “snap-ins” to load.&amp;#160;
After installing a kit (by placing it in one of many, configurable, pre-defined folders),
it can simply be enabled using a single PowerShell Command.&amp;#160; For example, to
enable the “MyCompany.MyKit” PowerKit:
&lt;/p&gt;
&lt;pre class="code"&gt;Enable-Kit MyCompany.MyKit&lt;/pre&gt;
&lt;p&gt;
Enabling a kit loads all the assemblies, script files, etc. into your PowerShell environment,
making them available for use.&amp;#160; A Kit can then be disabled similarly using the
”Disable-Kit” command.&amp;#160; Disabling the kit removes all the script files, etc.
from the environment (NOTE: .Net assemblies cannot be unloaded without restarting
PowerShell, due to a limitation of the .Net Framework).
&lt;/p&gt;
&lt;p&gt;
PowerKit also supports packaging kits into a ZIP-like format, specifically the &lt;a href="http://en.wikipedia.org/wiki/Open_Packaging_Convention" target="_blank"&gt;Open
Packaging Convention&lt;/a&gt; developed by Microsoft for Office 2007 (since the .Net framework
has built-in support for that format). These “Kit Archives” can be downloaded and
installed using a single command.&amp;#160; Eventually, I plan to add support for installing
a kit directly from the web, so you could use a command like this:
&lt;/p&gt;
&lt;pre class="code"&gt;Install-Kit &lt;a href="http://www.mycompany.com/MyCompany.MyKit.kit"&gt;http://www.mycompany.com/MyCompany.MyKit.kit&lt;/a&gt;&lt;/pre&gt;
&lt;p&gt;
Or even this:
&lt;/p&gt;
&lt;pre class="code"&gt;Install-Kit MyCompany.MyKit&lt;/pre&gt;
&lt;p&gt;
And the framework would go out and download the kit and install it, giving PowerShell
a true “gems-esque” packaging system.
&lt;/p&gt;
&lt;p&gt;
To install PowerKit, download the Install-PowerKit.ps1 script from the &lt;a href="http://www.codeplex.com/powerkits" target="_blank"&gt;CodePlex
site&lt;/a&gt;, more installation details are in the release notes on that page.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.andrewnurse.net/aggbug.ashx?id=ebff3ae0-84fe-4a4e-9dd8-531c9c469dee" /&gt;</description>
      <comments>http://blog.andrewnurse.net/CommentView,guid,ebff3ae0-84fe-4a4e-9dd8-531c9c469dee.aspx</comments>
      <category>CMPT 376</category>
      <category>PowerKit</category>
      <category>PowerShell</category>
    </item>
  </channel>
</rss>