<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>Assigning the Output of a SWITCH Statement</title><link>http://blogs.msdn.com/b/powershell/archive/2009/07/01/assigning-the-output-of-a-switch-statement.aspx</link><description>I was just reading the whitepaper Automating Citrix XenApp on XenServer deployments on HP ProLiant servers . The reason why this works well for them is that the HP Insight Rapid Deployment (RDP) software has the ability to launch scripts at various points</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Assigning the Output of a SWITCH Statement</title><link>http://blogs.msdn.com/b/powershell/archive/2009/07/01/assigning-the-output-of-a-switch-statement.aspx#9837591</link><pubDate>Fri, 17 Jul 2009 19:20:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9837591</guid><dc:creator>Smith Catar</dc:creator><description>&lt;p&gt;I forgot to say...&lt;/p&gt;
&lt;p&gt;I don't want to execute ps1 script with double-click,&lt;/p&gt;
&lt;p&gt;but I do want to execute ps1 script with only its name in a batch file or cmd.exe&lt;/p&gt;
&lt;p&gt;So I hoped easy way to do it as a standard feature of win7 or posh v2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9837591" width="1" height="1"&gt;</description></item><item><title>re: Assigning the Output of a SWITCH Statement</title><link>http://blogs.msdn.com/b/powershell/archive/2009/07/01/assigning-the-output-of-a-switch-statement.aspx#9818084</link><pubDate>Sun, 05 Jul 2009 17:37:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9818084</guid><dc:creator>Smith Catar</dc:creator><description>&lt;p&gt;Hi Jeffrey, I have a question.&lt;/p&gt;
&lt;p&gt;When I set powershell.exe as a default program for .ps1 file types in Windows 7,&lt;/p&gt;
&lt;p&gt;are there ways that do it easy and correctly?&lt;/p&gt;
&lt;p&gt;(like 'powershell.exe -File &amp;quot;%1&amp;quot;', not 'powershell.exe &amp;quot;%1&amp;quot;') &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9818084" width="1" height="1"&gt;</description></item><item><title>re: Assigning the Output of a SWITCH Statement</title><link>http://blogs.msdn.com/b/powershell/archive/2009/07/01/assigning-the-output-of-a-switch-statement.aspx#9811622</link><pubDate>Wed, 01 Jul 2009 21:23:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9811622</guid><dc:creator>Oisin Grehan</dc:creator><description>&lt;p&gt;Hey Jeffrey - you might want to mention that your example only works with later v2 powershell versions (post ctp3) that allow statements on the RHS. For v1.0, you need:&lt;/p&gt;
&lt;p&gt;$foo = $( switch(...) { ... } )&lt;/p&gt;
&lt;p&gt;e.g. a subexpression wrapping the switch.&lt;/p&gt;
&lt;p&gt;-Oisin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9811622" width="1" height="1"&gt;</description></item><item><title>re: Assigning the Output of a SWITCH Statement</title><link>http://blogs.msdn.com/b/powershell/archive/2009/07/01/assigning-the-output-of-a-switch-statement.aspx#9810922</link><pubDate>Wed, 01 Jul 2009 15:36:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9810922</guid><dc:creator>PowerShell Team</dc:creator><description>&lt;p&gt;Excellent question Philip!&lt;/p&gt;
&lt;p&gt;I thought about addressing this in the blog but then thought it would screw up the signal-to-noise ratio so I punted on it. &amp;nbsp;The problem is that the original code didn't have a &amp;quot;default&amp;quot; case on the switch so I don't know what they wanted to have happen. &amp;nbsp;In the case of the hash table, you use the ContainsKey() method on the hash table:&lt;/p&gt;
&lt;p&gt;if (!($map.ContainsKey($global:template))) {...}&lt;/p&gt;
&lt;p&gt;Thanks for asking!&lt;/p&gt;
&lt;p&gt;jps&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9810922" width="1" height="1"&gt;</description></item><item><title>re: Assigning the Output of a SWITCH Statement</title><link>http://blogs.msdn.com/b/powershell/archive/2009/07/01/assigning-the-output-of-a-switch-statement.aspx#9810601</link><pubDate>Wed, 01 Jul 2009 12:45:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9810601</guid><dc:creator>Philip Colmer</dc:creator><description>&lt;p&gt;I, for one, didn't know the trick with the hashtable and the map function. Nice! Definitely simplifies the switch statement (actually eliminates it)!&lt;/p&gt;
&lt;p&gt;What happens, though, if there isn't a match?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9810601" width="1" height="1"&gt;</description></item></channel></rss>