<?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>Huddled Masses &#187; Download</title>
	<atom:link href="http://huddledmasses.org/tag/download/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Fri, 27 Apr 2012 05:42:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Automating the PowerShell Script Repository</title>
		<link>http://huddledmasses.org/automating-the-powershell-script-repository/</link>
		<comments>http://huddledmasses.org/automating-the-powershell-script-repository/#comments</comments>
		<pubDate>Fri, 30 May 2008 04:16:39 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[wGet]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/?p=547</guid>
		<description><![CDATA[So, people keep talking about a better PowerShell script repository, and there&#8217;s at least 3 or 4 different people working on improvements, but for now, the one we have is working ok, and already has hundreds of scripts in it &#8212; but there hasn&#8217;t been a way to add or retrieve scripts from within PowerShell. [...]]]></description>
			<content:encoded><![CDATA[	<p>So, people keep talking about a better PowerShell script repository, and there&#8217;s at least 3 or 4 different people working on improvements, but for now, the one we have is working ok, and already has hundreds of scripts in it &#8212; but there hasn&#8217;t been a way to add or retrieve scripts from within PowerShell.</p>

	<p>So while I was taking a break from working on my own replacement script repository  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' />  I whipped up some scripts to <code>Send-Paste</code>, <code>Get-Paste</code> and <code>Find-Paste</code>.  These scripts still need some work, but I think you&#8217;ll find them useful, so I&#8217;ve posted a version that is compatible with PowerShell v1 (and works fine on the 2.0 <span class="caps">CTP</span>) and doesn&#8217;t need any additional scripts (it <em>includes</em> the latest <a href="http://powershellcentral.com/scripts/417">Get-WebFile</a> script for downloading the files).</p>

	<p>The <code>Find-Paste</code> function takes a search string, and adds wildcards &#8212; but otherwise performs the same search as you can already do on the web page. It returns the results in a PowerShell friendly PSObject which by default is just displayed in the host.  </p>

	<p>In order to download a script using <code>Get-Paste</code>, you must know the ID of the script &#8212; which you can get from the output of Find-Paste.  Note that because Find-Paste does a full-text search, you may get results that are not the script you&#8217;re looking for (if they call that script, for instance), and you may get many versions of the script (and newer versions are not necessarily at the top of the search results).</p>

	<p>The <code>Send-Paste</code> script is most useful for sending things to the <a href="http://posh.Jaykul.com/p/">temporary PowerShell pastebin on my site</a> but can be used successfully to send scripts to the permanent <a href="http://PowerShellCentral.com/scripts/">PowerShell Script Repository</a> &#8230; in fact, that&#8217;s how I uploaded the <a href='http://HuddledMasses.org/automating-the-powershell-script-repository/pastebin/' rel='attachment wp-att-550'>PowerShell Pastebin Functions</a> <a href="http://powershellcentral.com/scripts/421">to the repository</a> &#8230; you just have to be careful to specify the title and description when you do that. <strong>Edit</strong>: I attached the script <a href="http://huddledmasses.org/wordpress/wp-content/uploads/2008/06/pastebin.ps1">here on my site</a> also because I made a mistake and deleted the original copy from the repository.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt='[new]' class='wp-smiley' /> </p>

	<p>So, you now have something a little bit more like a proper script repository.  Hopefully the <em>Usage</em> comments in the script will be enough to help you figure out how to use the various commands, (and I did blog about the <a href="http://huddledmasses.org/powershell-send-paste-script/">Send-Paste</a> script about a month ago) but just in case you need help, let me give you a simple example.</p>

	<p>Suppose I need to find a script to encrypt text so I can store some SecureString objects (like the passwords in a PSCredential object) in a file&#8230;</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">100</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">Find-<span style="font-style: normal;">Paste</span></span> encrypt<br />
<br />
Id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">116</span><br />
Title &nbsp; &nbsp; &nbsp; : <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span><br />
Description : Functions to encrypt <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> decrypt strings <span style="color: #666699; font-weight: bold;">using</span> the Rijndael symmetric key algorithm<br />
Author &nbsp; &nbsp; &nbsp;: Joel Bennett<br />
Date &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">133</span> days ago<br />
Link &nbsp; &nbsp; &nbsp; &nbsp;: http:<span style="color: #66cc66;">//</span>powershellcentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>scripts<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">116</span><br />
<br />
Id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">416</span><br />
Title &nbsp; &nbsp; &nbsp; : Pastebin Functions<br />
Description : <span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">Paste</span></span>, <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span>, <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> <span style="color: #0066cc; font-style: italic;">Find-<span style="font-style: normal;">Paste</span></span> ... <span style="color: #003366;">to</span> let you use PowerShellCentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>Scripts a little bit <span style="color: #660033;">more</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333399; font-weight: bold; font-style: italic;">like</span> CPAN <span style="color: #666699; font-weight: bold;">while</span> you wait <span style="color: #666699; font-weight: bold;">for</span> us to get our act together <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> give you something better. :<span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IMPORTANT NOTE: the <span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">Paste</span></span> script defaults to our <span style="color: #66cc66;">*</span>temporary<span style="color: #66cc66;">*</span> pastebin site because we <span style="color: #666699; font-weight: bold;">do</span> <span style="color: #333399; font-weight: bold; font-style: italic;">not</span> want <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; you to fill up the central pastebin site with snippets ... <span style="color: #003366;">but</span> the other two default to the main long<span style="color: #66cc66;">-</span>term <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; script repository.<br />
<span style="color: #003366;">Author</span> &nbsp; &nbsp; &nbsp;: Joel Bennett<br />
Date &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">1</span> hour ago<br />
Link &nbsp; &nbsp; &nbsp; &nbsp;: http:<span style="color: #66cc66;">//</span>powershellcentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>scripts<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">416</span></div>

	<p>It looks like I found two, but clearly the second one is not the right one (I mentioned this in one of my examples in the pastebin scripts, and amusingly enough, that screwed up my example). So to download the script I want, I just do:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">101</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span> <span style="color: #cc66cc;">116</span> <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span><br />
<br />
&nbsp; &nbsp; Directory: Microsoft.<span style="color: #003366; font-weight: bold;">PowerShell</span>.<span style="color: #003366;">Core</span>\FileSystem::<span style="color: #003366;">C</span>:\Users\Joel\Documents\WindowsPowerShell\Scripts<br />
<br />
Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LastWriteTime &nbsp; &nbsp; &nbsp; Length Name<br />
<span style="color: #66cc66;">----</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">-------------</span> &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">------</span> <span style="color: #66cc66;">----</span><br />
<span style="color: #66cc66;">-</span>a<span style="color: #66cc66;">---</span> &nbsp; &nbsp; <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2008</span> <span style="color: #cc66cc;">12</span>:<span style="color: #cc66cc;">23</span> AM &nbsp; &nbsp; <span style="color: #cc66cc;">2.378</span> KB <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span></div>

	<p>Simple enough, right? I could have used the -Passthru option to <em>see</em> the script in the console, but since I was pretty sure it was the only one that might be useful (and since using -Passthrough just to display it on the console would mean downloading it a second time, if I actually wanted it).  Another option would be to use the Tee-Object cmdlet, which would let us download it, show it in the host, and also save it in the file, all at once!  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' /> </p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span> <span style="color: #cc66cc;">116</span> <span style="color: #000066;">-Passthru</span> <span style="color: #66cc66;">|</span> <span style="color: #660033;">tee</span> <span style="color: #000066;">-file</span> <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span></div>

	<p>Incidentally, I have a version of this which uses my <a href="http://huddledmasses.org/get-web-another-round-of-wget-for-powershell/">PoshHttp snapin and Get-Web cmdlet</a>, but it&#8217;s also written as a module and therefore requires PowerShell 2.0 CTP2 &#8212; for various reasons, I&#8217;m choosing to release that one separately later.  If you <strong>are</strong> using the <span class="caps">CTP</span>, you could take advantage of the <span class="caps">WPF</span> UI abilities and try piping <code>Find-Script ... | &#34;Select-Grid&#34;:http://huddledmasses.org/wpf-from-powershell-select-grid/ | Get-Script</code> to pick the script you want visually.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':-D' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/automating-the-powershell-script-repository/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

