<?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>Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx</link><description>Microsoft senior software engineer on the Windows PowerShell team, Lee Holmes, provides expert commentary for 2012 Scripting Games Advanced Event 6.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3495149</link><pubDate>Sun, 29 Apr 2012 09:59:32 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3495149</guid><dc:creator>Jan Egil Ring</dc:creator><description>&lt;p&gt;@K_Schulte @Srisas I made some customizations to the script, so the line numbers I mentioned above is incorrect. The correct numbers from the original script is 61 and 66.&lt;/p&gt;
&lt;p&gt;I also forgot line 83:&lt;/p&gt;
&lt;p&gt;ComputerName = $result.__server;&lt;/p&gt;
&lt;p&gt;One additional tip: You may want to use Unicode encoding on Export-Csv:&lt;/p&gt;
&lt;p&gt;$outputObject | Export-Csv $outputPath -NoTypeInformation -Encoding Unicode&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3495149" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3495148</link><pubDate>Sun, 29 Apr 2012 09:46:23 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3495148</guid><dc:creator>Jan Egil Ring</dc:creator><description>&lt;p&gt;@K_Schulte @Srisas To make it work in V2, do the following changes:&lt;/p&gt;
&lt;p&gt;Line #63: $output = @(Wait-Job $j | ForEach-Object {Receive-Job $_})&lt;/p&gt;
&lt;p&gt;Explanation: In PowerShell 3.0 we got a new feature called &amp;quot;Property Unrolling&amp;quot;, which made this line work in V3 without using a foreach:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.nivot.org/nivot2/post/2012/03/16/PowerShell-30%E2%80%93Now-with-Property-Unrolling!.aspx"&gt;www.nivot.org/.../PowerShell-30%E2%80%93Now-with-Property-Unrolling!.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Line #71: Write-Progress -Activity &amp;quot;Processing&amp;quot; -Status $result.__server&lt;/p&gt;
&lt;p&gt;Explanation: Like Jason Hofferle said; In PowerShell 3.0, the __Server property will have a PSComputerName alias for consistency.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3495148" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494913</link><pubDate>Fri, 27 Apr 2012 10:09:35 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494913</guid><dc:creator>Srisas</dc:creator><description>&lt;p&gt;On Powershell V3, $output = @(Wait-Job $j | Receive-Job) also worked fine. The script as provided by Lee works fine with Powershell V3, but gives the errors mentioned in the comment by @K_Schulte in Powershell V2.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3494913" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494860</link><pubDate>Fri, 27 Apr 2012 03:23:42 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494860</guid><dc:creator>Lee Holmes [MSFT]</dc:creator><description>&lt;p&gt;@Jason and @mjolinor - It requires only WMI to be enabled. Not PowerShell Remoting. Can you file a doc bug on &lt;a rel="nofollow" target="_new" href="http://connect.microsoft.com/PowerShell?"&gt;connect.microsoft.com/PowerShell&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=3494860" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494769</link><pubDate>Thu, 26 Apr 2012 17:15:35 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494769</guid><dc:creator>mjolinor</dc:creator><description>&lt;p&gt;I didn&amp;#39;t use background jobs. After reading, as Jason did, that using -AsJob requires remoting on both the local and target systems. I&amp;#39;d read Ed&amp;#39;s hints that he&amp;#39;d posted the day before and noted that the scenario did not specify that I could expect all the servers to be 2008R2 with remoting enabled. &amp;nbsp;That caused me to think that using that as a solution might produce a failing grade if it was tested against W2K servers.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3494769" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494605</link><pubDate>Thu, 26 Apr 2012 03:27:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494605</guid><dc:creator>Srisas</dc:creator><description>&lt;p&gt;Thanks, Jason. Yes, Powershell 3.0 does have this alias, was trying out the solution on Powershell 2.0 ( which is what I used for the Scripting Games ) and this alias is not present in 2.0.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3494605" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494434</link><pubDate>Wed, 25 Apr 2012 13:09:38 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494434</guid><dc:creator>Jason Hofferle</dc:creator><description>&lt;p&gt;The help for Get-WmiObject notes the following for the -AsJob parameter:&lt;/p&gt;
&lt;p&gt;Note: To use this parameter with remote computers, the local and remote computers must be configured for remoting. Additionally,&lt;/p&gt;
&lt;p&gt;you must start Windows PowerShell by using the &amp;quot;Run as administrator&amp;quot; option in Windows Vista and later versions of Windows,. For&lt;/p&gt;
&lt;p&gt;more information, see about_Remote_Requirements.&lt;/p&gt;
&lt;p&gt;Srisas: In PowerShell 3.0, the __Server property will have a PSComputerName alias for consistency.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3494434" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494085</link><pubDate>Tue, 24 Apr 2012 15:22:33 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494085</guid><dc:creator>Cruz_Daniel</dc:creator><description>&lt;p&gt;This makes me feel good about using Jobs in my entry but I can see I have a bit to learn. This is a good one.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3494085" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494028</link><pubDate>Tue, 24 Apr 2012 10:12:29 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494028</guid><dc:creator>Srisas</dc:creator><description>&lt;p&gt;I believe Get-WmiObject does not use the remoting infrastructure, hence the PSComputerName property will not be available in the result, we can use the __SERVER property instead. Otherwise, as @K_Schulte mentioned, we get an error in Write-Progress, and the excel file created does not contain the computer name.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3494028" width="1" height="1"&gt;</description></item><item><title>re: Expert Commentary: 2012 Scripting Games Advanced Event 6</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/23/expert-commentary-2012-scripting-games-advanced-event-6.aspx#3494017</link><pubDate>Tue, 24 Apr 2012 09:12:43 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3494017</guid><dc:creator>Srisas</dc:creator><description>&lt;p&gt;I am seeing similar results as @K_Schulte. With more than 1 machine, $output is empty. The following also does not return anything&lt;/p&gt;
&lt;p&gt;$j | Receive-Job&lt;/p&gt;
&lt;p&gt;whereas Receive-Job -job $j works fine.&lt;/p&gt;
&lt;p&gt;If the ChildJobs.Count is more than 1, this behavior is observed. If only 1 machine is specified ( ChildJobs.Count is 1 ), output is displayed properly.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3494017" width="1" height="1"&gt;</description></item></channel></rss>