<?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>Use PowerShell to Pick Random Winning Users from Text</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/09/08/use-powershell-to-pick-random-winning-users-from-text.aspx</link><description>Summary : Learn how to use Windows PowerShell to select random winners from a text file.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Use PowerShell to Pick Random Winning Users from Text</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/09/08/use-powershell-to-pick-random-winning-users-from-text.aspx#3452213</link><pubDate>Fri, 09 Sep 2011 21:09:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3452213</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@Klaus You are welcome. Script blocks are cool, and PowerShell accepts them into some rather unusual places -- not all of which are actually documented. One of the way I find cool things to do, I experiment and see what works and what does not work. What I am doing with Sort, is using a script block to obtain a random number from Get-Random ... then I sort it ... pretty cool.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3452213" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Pick Random Winning Users from Text</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2011/09/08/use-powershell-to-pick-random-winning-users-from-text.aspx#3451840</link><pubDate>Thu, 08 Sep 2011 12:02:26 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3451840</guid><dc:creator>Klaus Schulte</dc:creator><description>&lt;p&gt;Hi Ed,&lt;/p&gt;
&lt;p&gt;that&amp;#39;s again some powershell magic, what you have shown here!&lt;/p&gt;
&lt;p&gt;I even didn&amp;#39;t know that you can add a scriptblock to sort like you did in the line:&lt;/p&gt;
&lt;p&gt;&amp;quot;gc C:\fso\UserGroupNames.txt | sort{get-random} | select -First 5&amp;quot;&lt;/p&gt;
&lt;p&gt;And I still wonder why and how &amp;quot;sort{get-random}&amp;quot; works ... !?&lt;/p&gt;
&lt;p&gt;I read through the help but can&amp;#39;t figure out what&amp;#39;s going on (behind the scenes) ...&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=3451840" width="1" height="1"&gt;</description></item></channel></rss>