<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx</link><description>Summary: Microsoft Scripting Guy Ed Wilson shows how to deal with two Windows PowerShell hash table quirks.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3532279</link><pubDate>Tue, 13 Nov 2012 16:22:17 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3532279</guid><dc:creator>Dan Iverson</dc:creator><description>&lt;p&gt;I don&amp;#39;t know who this is written for, there are big sections with little or no explination. &amp;nbsp;I don&amp;#39;t get the refference to the part &amp;quot;too much trouble to do for a simple pipeline operation.&amp;quot; &amp;nbsp;I don&amp;#39;t know how that helps us figure out how to learn this stuff. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The section after that leave me to believe the best we can do is guess what the output was and if that would match the imput requirments... &amp;nbsp;Isn&amp;#39;t there a way to look in the help filles and see type of service and the output and look at the help files of the other side of the pipe and see what the input requirments are? &lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what I am talking about yet, but I would think you would want to teach us how to follow a consistant path to fine the right way to find the matches between the pieces.&lt;/p&gt;
&lt;p&gt;Function New-Question&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; Param(&lt;/p&gt;
&lt;p&gt; Function New-Question&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; Param(&lt;/p&gt;
&lt;p&gt; &amp;nbsp;[hashtable]$Puzzle&lt;/p&gt;
&lt;p&gt;What is a Function and what is a Param?&lt;/p&gt;
&lt;p&gt;What is &amp;nbsp;[hashtable]$Puzzle?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3532279" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3526256</link><pubDate>Tue, 16 Oct 2012 08:19:46 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3526256</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Since Get-Contents returns an object per line, its result, an array of lines, is not quite suited to be piped directly to ConvertFrom-StringData since the latter expects a string. To remedy this we can use Out-String:&lt;/p&gt;
&lt;p&gt;$hash$ = gc file.txt | Out-String | ConvertFrom-StringData&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3526256" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3460167</link><pubDate>Wed, 19 Oct 2011 10:07:06 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3460167</guid><dc:creator>Pipeline</dc:creator><description>&lt;p&gt;I like your blog it is great job.&lt;/p&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://kundedata.dk/moduler.aspx/&amp;quot;&amp;gt;Pipeline&amp;lt;/a&amp;gt;"&gt;kundedata.dk/.../a&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3460167" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3459600</link><pubDate>Mon, 17 Oct 2011 07:33:49 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3459600</guid><dc:creator>Klaus Schulte</dc:creator><description>&lt;p&gt;Hi Ed,&lt;/p&gt;
&lt;p&gt;hash tables are great and this practical example (and the try and error approach to solve the riddle of the returned array of hasttables:-) are stuff that we need to know and use in daily work.&lt;/p&gt;
&lt;p&gt;Sometimes it is not obvious why powershell doesn&amp;#39;t seem to &amp;quot;do the right thing&amp;quot; ... that what we expect to get and I often had to &amp;quot;debug&amp;quot; the data structures which seemed to be a bit strange ( at first and second sight). I&amp;#39;m afraid we all need a bit more practice to be able to handle this &amp;quot;without even thinking&amp;quot; ...&lt;/p&gt;
&lt;p&gt;A side note ... repeated from last week: &amp;nbsp; &amp;nbsp; &amp;quot;If($puzzle.contains($rtn))&amp;quot; should be &amp;quot;if ($P -eq $rtn)&amp;quot; :-)&lt;/p&gt;
&lt;p&gt;@jv: You are right ... !&lt;/p&gt;
&lt;p&gt;Klaus.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3459600" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3459557</link><pubDate>Mon, 17 Oct 2011 00:11:13 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3459557</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@jv you mean like, &amp;quot;stay tuned for these exciting messages...&amp;quot;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3459557" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3459552</link><pubDate>Sun, 16 Oct 2011 22:14:29 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3459552</guid><dc:creator>JV</dc:creator><description>&lt;p&gt;#Ed - sounds like a cliffhanger from the old days.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3459552" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3459544</link><pubDate>Sun, 16 Oct 2011 20:34:58 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3459544</guid><dc:creator>Ed WIlson</dc:creator><description>&lt;p&gt;@JV I am changing the subject next week :-) but I will come back to Hash Tables -- in Windows PowerShell they are very important for many different reasons. I am working on an article right now involving WMI, but the syntax takes a Hash table. A PowerShell user needs to be able to immediately type a hash table without even thinking to be truely effective.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3459544" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3459526</link><pubDate>Sun, 16 Oct 2011 15:01:22 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3459526</guid><dc:creator>jv</dc:creator><description>&lt;p&gt;@Ed&lt;/p&gt;
&lt;p&gt;As you are showing us in detail, hashes are g4reat tools to use in many areas. &amp;nbsp;I can&amp;#39;t wait to see where you take this next. &amp;nbsp;Or maybe somewher completely different.&lt;/p&gt;
&lt;p&gt;Keep up the great blogs.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3459526" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3459520</link><pubDate>Sun, 16 Oct 2011 12:54:59 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3459520</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@jv that is a really cool script, and you are right it is a good way to deal with return values wrapped in an array. Thank you for your comment -- and for your script. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3459520" width="1" height="1"&gt;</description></item><item><title>re: Dealing with PowerShell Hash Table Quirks</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/16/dealing-with-powershell-hash-table-quirks.aspx#3459519</link><pubDate>Sun, 16 Oct 2011 12:51:45 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3459519</guid><dc:creator>jv</dc:creator><description>&lt;p&gt;Here is an interesting real-world use for a hash table.&lt;/p&gt;
&lt;p&gt;When we return values from Active Directory using the [adsisearcher] or the DirectorySeracher class the values all come &amp;#39;wrapped&amp;#39; as an array or collection. &amp;nbsp;This makes them sort of inconvenient to use. &lt;/p&gt;
&lt;p&gt;Here is how you can easily leverage a hash to regenerate the properties as a normal set of properties along with how to use the searchers with a custom set of properties.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://gallery.technet.microsoft.com/scriptcenter/Extract-arbitrary-list-of-6f59d3b4"&gt;gallery.technet.microsoft.com/.../Extract-arbitrary-list-of-6f59d3b4&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3459519" width="1" height="1"&gt;</description></item></channel></rss>