<?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>Windows PowerShell Blog</title><link>http://blogs.msdn.com/powershell/default.aspx</link><description>Automating the world one-liner at a time.
&lt;table border=0 width=100%&gt;&lt;tr&gt;&lt;td align=right&gt;&lt;a href='http://blogs.msdn.com/powershell/pages/download-windows-powershell.aspx'&gt;&lt;u&gt;Click Here&lt;/u&gt;&lt;/a&gt; to Download PowerShell&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Windows Server 2008 R2 Rocks!</title><link>http://blogs.msdn.com/powershell/archive/2009/11/09/windows-server-2008-r2-rocks.aspx</link><pubDate>Mon, 09 Nov 2009 16:05:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9919585</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9919585.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9919585</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9919585</wfw:comment><description>&lt;p&gt;One of the things I like to say is that, “Microsoft is incapable of sustained error”.&amp;#160; By that I mean that Microsoft is an intensely self-conscious culture, fearless about confronting shortcomings and&amp;#160; constantly looking for ways to do things better.&amp;#160; We beat ourselves up pretty brutally about the shortcomings of Vista and committed ourselves to doing better going forward.&amp;#160; This is one of the reasons why Windows Server 2008 was such a good release.&amp;#160; We didn’t stop there, we raised the bar for Windows 7 and Windows Server 2008 R2.&lt;/p&gt;  &lt;p&gt;Part of that was the product itself.&amp;#160; Anyone that uses either of these products can see that immediately.&amp;#160; These are solid, high quality products.&amp;#160; We also raised the bar and teaching people about the release.&amp;#160; &lt;/p&gt;  &lt;p&gt;This morning, MSDN’s Channel9 opened up a new site for learning about WS08/R2 &lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/"&gt;HERE&lt;/a&gt;.&amp;#160; This site has lessons and short training videos for the following WS08/R2 topics:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Designed for Performance&lt;/li&gt;    &lt;li&gt;Designed for Efficiency&lt;/li&gt;    &lt;li&gt;Server Core .NET Application Server&lt;/li&gt;    &lt;li&gt;The Extensible Web Platform&lt;/li&gt;    &lt;li&gt;Extreme Web Services&lt;/li&gt;    &lt;li&gt;The Extensible File Classification Infrastructure&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/"&gt;Windows PowerShell is Powerful Automation!&lt;/a&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/PowerShellV2forDevelopers/"&gt;Powershell V2 for Developers&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/PowerShell/"&gt;Windows PowerShell is Powerful Automation!&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/VPowerShell2/"&gt;Variables, Types, and Operators&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/VPowerShell3/"&gt;Array’s Conditionals, Collections, and Loops&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/VPowerShell4/"&gt;Create Object Cmdlets&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/VPowerShell5/"&gt;Remote Sessions&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://channel9.msdn.com/learn/courses/WindowsServer2008R2/PowerShell/VPowerShell6"&gt;Advanced Remote Sessions&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;VHD and Hyper-V APIs Enable Creative New Solutions&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Much of this content if focused on developers but admin/It Pro scripters will find PowerShell section useful and appropriate.&lt;/p&gt;  &lt;p&gt;Experiment!&amp;#160; Enjoy!&amp;#160; Engage! &lt;/p&gt;  &lt;p&gt;Jeffrey Snover [MSFT]   &lt;br /&gt;Distinguished Engineer    &lt;br /&gt;Visit the Windows PowerShell Team blog at:&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;    &lt;br /&gt;Visit the Windows PowerShell ScriptCenter at:&amp;#160; &lt;a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9919585" width="1" height="1"&gt;</description></item><item><title>PowerPack Challenge</title><link>http://blogs.msdn.com/powershell/archive/2009/11/05/powerpack-challenge.aspx</link><pubDate>Thu, 05 Nov 2009 16:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9918071</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9918071.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9918071</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9918071</wfw:comment><description>&lt;P&gt;&lt;SPAN class=powerpackchallengeHeader&gt;&lt;STRONG&gt;Quest Software’s PowerPack Challenge’09&lt;/STRONG&gt;&lt;/SPAN&gt; is on... calling all script warriors to show their skills.&lt;/P&gt;
&lt;P&gt;See the details here - &lt;A href="http://powergui.org/powerpackchallenge.jspa"&gt;http://powergui.org/powerpackchallenge.jspa&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Happy Scritping&lt;/P&gt;
&lt;P&gt;Osama Sajid, Program Manager&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9918071" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/powershell/archive/tags/Quest+Software+PowerPack+Challenge/default.aspx">Quest Software PowerPack Challenge</category></item><item><title>Why is Get-ChildItem so Slow?</title><link>http://blogs.msdn.com/powershell/archive/2009/11/04/why-is-get-childitem-so-slow.aspx</link><pubDate>Wed, 04 Nov 2009 20:52:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9917540</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9917540.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9917540</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9917540</wfw:comment><description>&lt;p&gt;We get this question fairly frequently when it comes to slow network connections.&lt;/p&gt;  &lt;p&gt;The performance of directory listings (especially on a laggy network) are limited by the .NET APIs we call to retrieve the directory information. There are two limitations to the current set of APIs:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Forced Retrieval of Attributes&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When we do a directory listing, we show the standard attributes of the file or directory: Mode, LastWriteTime, Length, and Name. The core Windows API is highly optimized for this basic scenario, and returns these attributes by default along with the rest of the file information. However, the .NET Framework doesn’t take advantage of this data, and instead goes back to the network location to ask for all of the file attributes. This chatty behaviour adds a handful of network round trips for each file or directory, making the directory listing many times slower: hundreds or thousands of times slower in many cases. The Framework team addressed this as &lt;a href="http://blogs.msdn.com/bclteam/archive/2008/11/04/what-s-new-in-the-bcl-in-net-4-0-justin-van-patten.aspx"&gt;part of .NET 4.0&lt;/a&gt;, and you’ll see the benefits of this new feature as soon as we are able to adopt it.&lt;/p&gt;  &lt;p&gt;In version two, even without the benefit of the new .NET API, though, you’ll see a huge improvement in wildcarded directory listings (both local and remote.)&lt;/p&gt;  &lt;p&gt;As a background, PowerShell wildcards are different than straight cmd.exe wildcards. For example, PowerShell wildcards do not match the 8.3 short file name, while the native filesystem filtering (exposed by cmd.exe wildcards) do. PowerShell’s wildcards support character ranges, while the native file system filtering support does not. Because of this, PowerShell wildcard processing happens AFTER we’ve retrieved all of the files. &lt;/p&gt;  &lt;p&gt;This comes at a cost, however. Native file system filtering (as exposed by the &lt;font face="Courier New"&gt;–Filter&lt;/font&gt; parameter) is MUCH faster, as its processing is wired into the Windows file system.&lt;/p&gt;  &lt;p&gt;In version two, we did a bunch of work to resolve this strain. When you provide a PowerShell wildcard, we convert as much of it as possible to a native filesystem filter, and then apply our wildcarding logic to the much smaller set of results. You’ve probably noticed this most in tab completion, but it makes huge improvements in regular wildcarded directory listings. Especially remote ones. Since the native filtering is processed by the &lt;em&gt;remote&lt;/em&gt; file system, we don’t need to suffer the performance penalty of accessing attributes of files that you ultimately don’t care about anyways. In version one, you can work around the issue by specifying the &lt;font face="courier new"&gt;–Filter&lt;/font&gt; parameter directly. If this still doesn’t provide the speed you need, you can call “&lt;font face="Courier New"&gt;cmd.exe /c dir&lt;/font&gt;”.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Lack of Enumeration API&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This issue raises itself for directory listings that contain many files. The DirectoryInfo.GetFiles() method returns an array. When creating that result list, the .NET Framework does many re-allocations (and copies) of that array, causing an exponential performance degradation:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="GetChildItemPerf" border="0" alt="GetChildItemPerf" src="http://blogs.msdn.com/blogfiles/powershell/WindowsLiveWriter/WhyisGetChildItemsoSlow_97A0/GetChildItemPerf_1.jpg" width="570" height="358" /&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This, too, has been resolved in the .NET 4.0 updates, by offering an API that lets you enumerate through a directory result, rather than retrieve them all at once. If you are running into these limitations, you can again apply a wildcarding approach. If this still doesn’t provide the speed you need, you can call “&lt;font face="Courier New"&gt;cmd.exe /c &amp;lt;command&amp;gt;&lt;/font&gt;”.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Why Don’t We Fix It?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Since cmd.exe isn’t impacted by these issues, why don’t we just do the same thing and call into the core Windows APIs directly? The reason is twofold:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;A core tenet of PowerShell is providing access to the REAL underlying .NET objects. If we implemented the semantics ourselves, we’d have to return new types of objects – something like PSFileInfo and PSDirectoryInfo. V1 scripts (or downstream cmdlets) that expect the REAL underlying .NET objects would fail to work. While we could add a new switch (&lt;font face="Courier New"&gt;-Raw&lt;/font&gt;?), users would still have to change their scripts to support it. In that case, they might as well use the existing cmd /c workaround.&lt;/li&gt;    &lt;li&gt;This issue is ultimately transient. While it’s annoying to drag out over a few years, it will ultimately come and go without users having to change their behaviour. One day, you’ll install a build and the issues will just magically be gone.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Again, thanks for your continuing feedback. That’s what ultimately helped us discover the issue and make sure the right people knew about it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lee Holmes [MSFT]   &lt;br /&gt;Windows PowerShell Development    &lt;br /&gt;Microsoft Corporation&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9917540" width="1" height="1"&gt;</description></item><item><title>Workaround for Add-Member on plain .Net objects</title><link>http://blogs.msdn.com/powershell/archive/2009/11/03/workaround-for-add-member-on-plain-net-objects.aspx</link><pubDate>Tue, 03 Nov 2009 23:57:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9917057</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9917057.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9917057</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9917057</wfw:comment><description>&lt;h3&gt;Introduction&lt;/h3&gt;  &lt;p&gt;While I was fixing bugs, I came across an interesting bug (&lt;a href="https://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=382818"&gt;https://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=382818&lt;/a&gt;) that seemed to have a very simple fix upon first glance. However, after doing some more research, I found out that it was actually very tricky to fix the root cause. If you do the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;$table = @{ key1=&amp;quot;val1&amp;quot;; key2=&amp;quot;val2&amp;quot; }     &lt;br /&gt;Add-Member -in $table -MemberType NoteProperty -Name test -Value testValue&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now if you pipe $table to Get-Member you will notice that the test property is missing. No matter how many times you repeat the same Add-Member operation, $table seems to be totally unaffected. However, if you access the test property or even a nonexistent property before you use Add-Member, the command will behave correctly.&lt;/p&gt;  &lt;h3&gt;Why is this happening?&lt;/h3&gt;  &lt;p&gt;In PowerShell, we create .Net objects as System.Object as opposed to System.Management.Automation.PSObject for performance reasons. This is because every time an object is converted from System.Object to PSObject, PowerShell has to build the metadata information by reflecting on the .Net object. Doing so can introduce unnecessary overhead since not all operations require PSObjects. When you do something with it (i.e. property access), it becomes a PSObject. However, when you pass a variable ($table) bound to an Object to a cmdlet such as Add-Member, the cmdlet internally converts the bound object into a PSObject. This effectively creates a copy of the original object and anything done to the PSObject is not reflected on the input object.&lt;/p&gt;  &lt;h3&gt;How can we work around it?&lt;/h3&gt;  &lt;p&gt;We are hoping to fix the root cause in the next release. However, the workaround is actually quite simple. Since Add-Member is able to emit the modified object if the –PassThru flag is specified, all you have to do is assigned the object back to your initial variable.&lt;/p&gt;  &lt;p&gt;$table = Add-Member -in $table NoteProperty Test &amp;quot;Test property&amp;quot; –PassThru&lt;/p&gt;  &lt;p&gt;Tianjie (James) Wei [MSFT]   &lt;br /&gt;Software Design Engineer    &lt;br /&gt;Windows PowerShell Team&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9917057" width="1" height="1"&gt;</description></item><item><title>Quick, Dirty, Super-Useful Scripting</title><link>http://blogs.msdn.com/powershell/archive/2009/10/31/quick-dirty-super-useful-scripting.aspx</link><pubDate>Sat, 31 Oct 2009 19:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915707</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9915707.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9915707</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9915707</wfw:comment><description>&lt;P&gt;Last weekend I installed the super-awesome W7 Ultimate on all the machines at home.&amp;nbsp; This weekend I decided to install the &lt;A href="http://www.microsoft.com/windows/virtual-pc/download.aspx" mce_href="http://www.microsoft.com/windows/virtual-pc/download.aspx"&gt;XP Virtual mode download&lt;/A&gt;.&amp;nbsp; I started to do this and noticed that it was 500MB.&amp;nbsp; That is large and is going to take a long time FOR EACH PC I have.&amp;nbsp; One of the reasons I got the Ultimate SKU is that it has &lt;A href="http://technet.microsoft.com/en-us/network/dd425028.aspx" mce_href="http://technet.microsoft.com/en-us/network/dd425028.aspx"&gt;BranchCache&lt;/A&gt;.&amp;nbsp; This is EXACTLY what Branchcache was designed to do.&amp;nbsp; One PC downloads something and puts it into a distributed cache and then when the other PCs go to download it, they get it from their peers instead of from the internet (given the way my son reacts when my downloads affects the network and&amp;nbsp; his ability to kill Nazi Zombies, I’m motivated to minimize the usage of the network :-) ).&lt;/P&gt;
&lt;P&gt;That sounds great but the Branchcache is not enabled by default so you have to set it up.&amp;nbsp; I was doing this and it was a pain in the butt so I decided to experiment with a quick and dirty script and I LOVE the results so I thought I would share.&lt;/P&gt;
&lt;P&gt;The issue is that they way you configure Branchcache is with NETSH.&amp;nbsp; The problem with that is that NETSH isn’t remotable.&amp;nbsp; I was going back and forth between machines trying things out.&amp;nbsp; I gave myself a dopeslap and I realized what I was doing and established a remote PowerShell session to the machines.&amp;nbsp; For a while I was doing Enter-PSSession which gives you an interactive session to the remote machine.&amp;nbsp; That was great but I have more than one machine so I either had to switch machines or have a couple of windows open.&amp;nbsp; Then I decided I would use Invoke-Command.&amp;nbsp; I created a remote connection to all the machines and then collected them in a variable $s and used ICM.&lt;/P&gt;
&lt;P&gt;PS&amp;gt; $s = GSN &lt;BR&gt;PS&amp;gt; icm $s {netsh branchcache show localcache}&lt;/P&gt;
&lt;P&gt;That worked great but it was a little clumsy to work with so I decided to write a quick-n-dirty function to make my life better. &lt;/P&gt;
&lt;P&gt;function b { icm $s -ScriptBlock $([scriptblock]::create("netsh branchcache $args "))}&lt;/P&gt;
&lt;P&gt;Notice that I’m not using VERB-NOUN.&amp;nbsp; Why should I?&amp;nbsp; I’m after FAST (minimal typing) and this is a throw away function.&amp;nbsp; “B” is perfect.&lt;/P&gt;
&lt;P&gt;Notice that I didn’t declare parameters.&amp;nbsp; Why should I?&amp;nbsp; I’m going quick.&amp;nbsp; I need it to work but I don’t need it to be formal.&lt;/P&gt;
&lt;P&gt;Notice that I use positional parameters and aliases?&amp;nbsp; Why not?&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Now what I’m able to do is:&lt;/P&gt;
&lt;P&gt;PS&amp;gt; b show localcache &lt;BR&gt;PS&amp;gt; b set service mode=DISTRIBUTED&lt;/P&gt;
&lt;P&gt;&amp;lt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;&amp;gt;&lt;BR&gt;&lt;EM&gt;I realized from the comments that I didn't deliver the punchline.&amp;nbsp; The WHOLE point was that the command is going to run on ALL the machines!&amp;nbsp; THAT's the crazy wonderful part of it.&lt;BR&gt;&lt;/EM&gt;&amp;lt;/&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;I haven’t got Branchcache working yet but I’m am zooming and having a blast.&amp;nbsp;&amp;nbsp; We spend a lot of time talking about best practices and formal scripting.&amp;nbsp; That is all super great and super important but there is NOTHING wrong with quick-n-dirty scripting for &lt;STRONG&gt;adhoc&lt;/STRONG&gt; functions.&amp;nbsp; The fact that we designed it so that you can do both with PowerShell is a source of great pride.&lt;/P&gt;
&lt;P&gt;GOD I LOVE POWERSHELL!&lt;/P&gt;
&lt;P&gt;Experiment!&amp;nbsp; Enjoy!&amp;nbsp; Engage! &lt;/P&gt;
&lt;P&gt;Jeffrey Snover [MSFT] &lt;BR&gt;Distinguished Engineer &lt;BR&gt;Visit the Windows PowerShell Team blog at:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://blogs.msdn.com/PowerShell" mce_href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/A&gt; &lt;BR&gt;Visit the Windows PowerShell ScriptCenter at:&amp;nbsp; &lt;A href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx" mce_href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915707" width="1" height="1"&gt;</description></item><item><title>Sending Automated emails with Send-MailMessage, ConvertTo-HTML, and the PowerShellPack’s TaskScheduler module</title><link>http://blogs.msdn.com/powershell/archive/2009/10/30/sending-automated-emails-with-send-mailmessage-convertto-html-and-the-powershellpack-s-taskscheduler-module.aspx</link><pubDate>Fri, 30 Oct 2009 19:32:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915418</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9915418.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9915418</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9915418</wfw:comment><description>&lt;p&gt;On October 15th I released a large collection of scripts called the &lt;a href="http://code.msdn.microsoft.com/PowerShellPack"&gt;PowerShellPack&lt;/a&gt;.&amp;#160; The PowerShellPack has tons of PowerShell V2 scripts that can be used to do all sorts of fun and practical things.&amp;#160; Today, we’ll show how to use a module in the PowerShell Pack to schedule sending a daily automated email with information about the installed programs on a given system.&lt;/p&gt;  &lt;p&gt;Turning the output of a PowerShell script into an automated email is a snap in PowerShell V2, thanks to a nifty new cmdlet called Send-MailMessage.&amp;#160; Send-MailMessage sends out emails with the credentials of the current user (or an arbitrary user) and an SMTP server.&amp;#160; Send-MailMessage can send HTML emails by using the –BodyAsHtml switch, and ConvertTo-HTML can take the output of a cmdlet and turn it into an HTML chunk.&amp;#160; If the email needs some introduction and a signature, you can always use ConvertTo-HTML’s new –PreContent and –PostContent parameters.&lt;/p&gt;  &lt;p&gt;Here’s a quick chunk of script that will send the email message once.&amp;#160; Notice that instead of having a very long line with a lot of parameters, I keep the parameters to Send-MailMessage in a Hashtable and use Splatting to provide them to Send-MailMessage&lt;/p&gt;  &lt;pre class="PowerShellColorizedScript"&gt;&lt;span style="color: #ff4500"&gt;            $messageParameters&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #000000"&gt;@{&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;Subject&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Installed Program report for $env:ComputerName.$env:USERDNSDOMAIN - $((Get-Date).ToShortDateString())&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;Body&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Get-WmiObject&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Win32_Product&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                    &lt;span style="color: #0000ff"&gt;Select-Object&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Name&lt;/span&gt;&lt;span style="color: #a9a9a9"&gt;,&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Version&lt;/span&gt;&lt;span style="color: #a9a9a9"&gt;,&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Vendor&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
                    &lt;span style="color: #0000ff"&gt;Sort-Object&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Name&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
                    &lt;span style="color: #0000ff"&gt;ConvertTo-Html&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                    &lt;span style="color: #0000ff"&gt;Out-String&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;From&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Me@MyCompany.com&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;To&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Me@MyCompany.com&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;SmtpServer&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;SmtpHost&amp;quot;&lt;/span&gt;                        
            &lt;span style="color: #000000"&gt;}&lt;/span&gt;                        
            &lt;span style="color: #0000ff"&gt;Send-MailMessage&lt;/span&gt; &lt;span style="color: #ff4500"&gt;@messageParameters&lt;/span&gt; &lt;span style="color: #000080"&gt;-BodyAsHtml&lt;/span&gt;                        &lt;/pre&gt;

&lt;p&gt;Now that we've got that chunk of code down, let's go ahead and make sure that any problems we encounter get put into a file somewhere.&amp;#160; I can do this by setting one of PowerShell’s magic variables $ErrorActionPreference = “Stop”, and adding a try/catch around all of my code: &lt;/p&gt;

&lt;pre class="PowerShellColorizedScript"&gt;&lt;span style="color: #ff4500"&gt;        $ErrorActionPreference&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Stop&amp;quot;&lt;/span&gt;                        
        &lt;span style="color: #00008b"&gt;try&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;                        
            &lt;span style="color: #ff4500"&gt;$messageParameters&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #000000"&gt;@{&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;Subject&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Installed Program report for $env:ComputerName.$env:USERDNSDOMAIN - $((Get-Date).ToShortDateString())&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;Body&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Get-WmiObject&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Win32_Product&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                    &lt;span style="color: #0000ff"&gt;Select-Object&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Name&lt;/span&gt;&lt;span style="color: #a9a9a9"&gt;,&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Version&lt;/span&gt;&lt;span style="color: #a9a9a9"&gt;,&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Vendor&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
                    &lt;span style="color: #0000ff"&gt;Sort-Object&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Name&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
                    &lt;span style="color: #0000ff"&gt;ConvertTo-Html&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                    &lt;span style="color: #0000ff"&gt;Out-String&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;From&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Me@MyCompany.com&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;To&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Me@MyCompany.com&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;SmtpServer&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;SmtpHost&amp;quot;&lt;/span&gt;                        
            &lt;span style="color: #000000"&gt;}&lt;/span&gt;                        
            &lt;span style="color: #0000ff"&gt;Send-MailMessage&lt;/span&gt; &lt;span style="color: #ff4500"&gt;@messageParameters&lt;/span&gt; &lt;span style="color: #000080"&gt;-BodyAsHtml&lt;/span&gt;                        
        &lt;span style="color: #000000"&gt;}&lt;/span&gt; &lt;span style="color: #00008b"&gt;catch&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;                        
            &lt;span style="color: #ff4500"&gt;$_&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                &lt;span style="color: #0000ff"&gt;Out-File&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;$env:TEMP\ProblemsSendingHotfixReport.log.txt&lt;/span&gt; &lt;span style="color: #000080"&gt;-Append&lt;/span&gt; &lt;span style="color: #000080"&gt;-Width&lt;/span&gt; &lt;span style="color: #800080"&gt;1000&lt;/span&gt;                        
        &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Finally, I’ll just go ahead and use the TaskScheduler module from PowerShellPack to make sure the email arrives every day.&amp;#160; To do this, I’ll need to download the PowerShellPack to the machine I’ll be scheduling the task on.&amp;#160;&amp;#160; Scheduling a task with the PowerShell Pack involves a short pipeline:&amp;#160; Ours will look something like:&lt;/p&gt;

&lt;pre class="PowerShellColorizedScript"&gt;&lt;span style="color: #0000ff"&gt;New-Task&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;            
    &lt;span style="color: #0000ff"&gt;Add-TaskAction&lt;/span&gt; &lt;span style="color: #000080"&gt;-Script&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;            
        &lt;span style="color: #006400"&gt;# Our Emailer Here&lt;/span&gt;            
    &lt;span style="color: #000000"&gt;}&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;            
    &lt;span style="color: #0000ff"&gt;Add-TaskTrigger&lt;/span&gt; &lt;span style="color: #000080"&gt;-Daily&lt;/span&gt; &lt;span style="color: #000080"&gt;-At&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;9:00 AM&amp;quot;&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
    &lt;span style="color: #0000ff"&gt;Add-TaskTrigger&lt;/span&gt; &lt;span style="color: #000080"&gt;-OnRegistration&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
    &lt;span style="color: #0000ff"&gt;Register-ScheduledTask&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;DailyHotfixReport&amp;quot;&lt;/span&gt;                &lt;/pre&gt;

&lt;p&gt;Piece of cake, right?&amp;#160; In our case, we’re sending an email at 9 AM every day (and when the task is registered) with the output of a simple cmdlet, but I could also use this to run a more complex task, and I can play around with the different trigger types to send the emails whenever I’d like.&lt;/p&gt;

&lt;p&gt;Here’s the full script:&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;pre class="PowerShellColorizedScript"&gt;&lt;span style="color: #0000ff"&gt;New-Task&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                        
    &lt;span style="color: #0000ff"&gt;Add-TaskAction&lt;/span&gt; &lt;span style="color: #000080"&gt;-Hidden&lt;/span&gt; &lt;span style="color: #000080"&gt;-Script&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;                        
        &lt;span style="color: #ff4500"&gt;$ErrorActionPreference&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Stop&amp;quot;&lt;/span&gt;                        
        &lt;span style="color: #00008b"&gt;try&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;                        
            &lt;span style="color: #ff4500"&gt;$messageParameters&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #000000"&gt;@{&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;Subject&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Installed Program report for $env:ComputerName.$env:USERDNSDOMAIN - $((Get-Date).ToShortDateString())&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;Body&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Get-WmiObject&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Win32_Product&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                    &lt;span style="color: #0000ff"&gt;Select-Object&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Name&lt;/span&gt;&lt;span style="color: #a9a9a9"&gt;,&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Version&lt;/span&gt;&lt;span style="color: #a9a9a9"&gt;,&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Vendor&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
                    &lt;span style="color: #0000ff"&gt;Sort-Object&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;Name&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;             
                    &lt;span style="color: #0000ff"&gt;ConvertTo-Html&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                    &lt;span style="color: #0000ff"&gt;Out-String&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;From&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Me@MyCompany.com&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;To&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;Me@MyCompany.com&amp;quot;&lt;/span&gt;                        
                &lt;span style="color: #000000"&gt;SmtpServer&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;=&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;SmtpHost&amp;quot;&lt;/span&gt;                        
            &lt;span style="color: #000000"&gt;}&lt;/span&gt;                        
            &lt;span style="color: #0000ff"&gt;Send-MailMessage&lt;/span&gt; &lt;span style="color: #ff4500"&gt;@messageParameters&lt;/span&gt; &lt;span style="color: #000080"&gt;-BodyAsHtml&lt;/span&gt;                        
        &lt;span style="color: #000000"&gt;}&lt;/span&gt; &lt;span style="color: #00008b"&gt;catch&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;                        
            &lt;span style="color: #ff4500"&gt;$_&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
                &lt;span style="color: #0000ff"&gt;Out-File&lt;/span&gt; &lt;span style="color: #8a2be2"&gt;$env:TEMP\ProblemsSendingHotfixReport.log.txt&lt;/span&gt; &lt;span style="color: #000080"&gt;-Append&lt;/span&gt; &lt;span style="color: #000080"&gt;-Width&lt;/span&gt; &lt;span style="color: #800080"&gt;1000&lt;/span&gt;                        
        &lt;span style="color: #000000"&gt;}&lt;/span&gt;                        
    &lt;span style="color: #000000"&gt;}&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;            
    &lt;span style="color: #0000ff"&gt;Add-TaskTrigger&lt;/span&gt; &lt;span style="color: #000080"&gt;-Daily&lt;/span&gt; &lt;span style="color: #000080"&gt;-At&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;9:00 AM&amp;quot;&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                        
    &lt;span style="color: #0000ff"&gt;Add-TaskTrigger&lt;/span&gt; &lt;span style="color: #000080"&gt;-OnRegistration&lt;/span&gt; &lt;span style="color: #a9a9a9"&gt;|&lt;/span&gt;                         
    &lt;span style="color: #0000ff"&gt;Register-ScheduledTask&lt;/span&gt; &lt;span style="color: #8b0000"&gt;&amp;quot;DailyHotfixReport&amp;quot;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;That wasn't bad, was it?&amp;#160; It took only 24 lines of PowerShell script to create a schedule task that emails me a fairly detailed report of all of the installed programs on the machine. As you can see, PowerShell V2 makes sending automated emails a snap, and the &lt;a href="http://code.msdn.microsoft.com/PowerShellPack"&gt;PowerShellPack&lt;/a&gt; makes scheduling this or any other script on a regular basis a piece of cake.&lt;/p&gt;

&lt;p&gt;Hope this Helps,&lt;/p&gt;

&lt;p&gt;James Brundage [MSFT]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915418" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/powershell/archive/tags/PowerShell+V2/default.aspx">PowerShell V2</category><category domain="http://blogs.msdn.com/powershell/archive/tags/PowerShellPack/default.aspx">PowerShellPack</category></item><item><title>Windows Management Framework is here!</title><link>http://blogs.msdn.com/powershell/archive/2009/10/27/windows-management-framework-is-here.aspx</link><pubDate>Tue, 27 Oct 2009 18:25:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9913618</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>22</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9913618.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9913618</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9913618</wfw:comment><description>&lt;p&gt;Windows Management Framework, which includes Windows PowerShell 2.0, WinRM 2.0, and BITS 4.0, was officially released to the world this morning. By providing a consistent management interface across the various flavors of Windows, we are making our platform that much more attractive to deploy. IT Professionals can now easily manage their Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2 machines through PowerShell remoting – that’s a huge win!&lt;/p&gt;  &lt;p&gt;You can download the packages here: &lt;b&gt;&lt;i&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=151321"&gt;http://go.microsoft.com/fwlink/?LinkID=151321&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lee Holmes [MSFT]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913618" width="1" height="1"&gt;</description></item><item><title>Tonight is the Virtual Launch Party @ PowerScripting Podcast</title><link>http://blogs.msdn.com/powershell/archive/2009/10/22/tonight-is-the-virtual-launch-party-powerscripting-podcast.aspx</link><pubDate>Thu, 22 Oct 2009 12:14:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9911299</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>29</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9911299.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9911299</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9911299</wfw:comment><description>&lt;p&gt;Tonight is the night!&amp;#160; &lt;/p&gt;  &lt;p&gt;I was super happy when we shipped V1 of PowerShell.&amp;#160; It started the journey.&amp;#160; That said, V2 is the release that we really wanted to release.&amp;#160; &lt;/p&gt;  &lt;p&gt;Today Windows 7 is publicly available and every version has PowerShell V2 in it.&amp;#160; &lt;/p&gt;  &lt;p&gt;Tonight – we party!&lt;/p&gt;  &lt;p&gt;I’ll be cracking a beer with Hal Rottenberg and Jonathan Walz (hosts of the &lt;a href="http://powerscripting.wordpress.com/"&gt;PowerScripting Podcast&lt;/a&gt;) in a PowerShell V2 Virtual Launch Party tonight at 9:30 PM EDT (GMT-4).&amp;#160; &lt;/p&gt;  &lt;p&gt;For more details and info on how to join us go &lt;a href="http://powerscripting.wordpress.com/2009/10/16/powershell-v2-virtual-launch-party/"&gt;HERE&lt;/a&gt;.&amp;#160; I’m looking forward to seeing you.&amp;#160; Note, you can always watch the podcast after the fact but if you join, you can make comments and ask questions in the chat room – lots of fun.&lt;/p&gt;  &lt;p&gt;Jeffrey Snover [MSFT]    &lt;br /&gt;Distinguished Engineer     &lt;br /&gt;Visit the Windows PowerShell Team blog at:&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;    &lt;br /&gt;Visit the Windows PowerShell ScriptCenter at:&amp;#160; &lt;a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9911299" width="1" height="1"&gt;</description></item><item><title>PowerShell V2 Virtual Launch Party</title><link>http://blogs.msdn.com/powershell/archive/2009/10/17/powershell-v2-virtual-launch-party.aspx</link><pubDate>Sat, 17 Oct 2009 21:30:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9908639</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9908639.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9908639</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9908639</wfw:comment><description>&lt;p&gt;I’ll be joining Hal Rottenberg and Jonathan Walz (hosts of the &lt;a href="http://powerscripting.wordpress.com/"&gt;PowerScripting Podcast&lt;/a&gt;) in a PowerShell V2 Virtual Launch Party this Thursday, Oct 22nd, 9:30 PM EDT (GMT-4).&amp;#160; &lt;/p&gt;  &lt;p&gt;For more details and info on how to join us go &lt;a href="http://powerscripting.wordpress.com/2009/10/16/powershell-v2-virtual-launch-party/"&gt;HERE&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Hmmm, I wonder if it is BYOB… :-)&lt;/p&gt;  &lt;p&gt;Experiment!&amp;#160; Enjoy!&amp;#160; Engage! &lt;/p&gt;  &lt;p&gt;Jeffrey Snover [MSFT]   &lt;br /&gt;Distinguished Engineer    &lt;br /&gt;Visit the Windows PowerShell Team blog at:&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;    &lt;br /&gt;Visit the Windows PowerShell ScriptCenter at:&amp;#160; &lt;a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9908639" width="1" height="1"&gt;</description></item><item><title>Announcing: Open Source PowerShell Cmdlet and Help Designer</title><link>http://blogs.msdn.com/powershell/archive/2009/10/16/announcing-open-source-powershell-cmdlet-and-help-designer.aspx</link><pubDate>Fri, 16 Oct 2009 18:26:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9908317</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9908317.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9908317</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9908317</wfw:comment><description>&lt;p&gt;&lt;a title="http://www.codeplex.com/CmdletDesigner" href="http://www.codeplex.com/CmdletDesigner"&gt;http://www.codeplex.com/CmdletDesigner&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;During the development of Windows 7, most cmdlet design and help authoring in Microsoft went through an internal tool called the “Cmdlet Designer.”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/powershell/WindowsLiveWriter/AnnouncingOpenSourcePowerShellCmdletandH_D27D/cmdlet_designer_2.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="cmdlet_designer" border="0" alt="cmdlet_designer" src="http://blogs.msdn.com/blogfiles/powershell/WindowsLiveWriter/AnnouncingOpenSourcePowerShellCmdletandH_D27D/cmdlet_designer_thumb.png" width="521" height="484" /&gt;&lt;/a&gt;The Cmdlet Designer makes it much easier for teams to concentrate on the design, naming, and consistency of their cmdlets, while also guaranteeing name registration and collision avoidance across Microsoft.&lt;/p&gt;  &lt;p&gt;To sweeten the deal, it offers:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Integrated help authoring &lt;/li&gt;    &lt;li&gt;Efficient bulk operations (parameter and cmdlet cloning) &lt;/li&gt;    &lt;li&gt;Generation of cmdlet code &lt;/li&gt;    &lt;li&gt;Full scripting support &lt;/li&gt;    &lt;li&gt;Automatic code-spec comparison and testing &lt;/li&gt;    &lt;li&gt;Role-based security, history logging, and more. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So why blog about it? &lt;strong&gt;Because it’s now yours&lt;/strong&gt;!&lt;/p&gt;  &lt;p&gt;We just posted the entirety of the Cmdlet Designer, its source code, design specification, and deployment guide to &lt;a title="http://www.codeplex.com/CmdletDesigner" href="http://www.codeplex.com/CmdletDesigner"&gt;http://www.codeplex.com/CmdletDesigner&lt;/a&gt; under the most permissive Microsoft Open Source license, the &lt;a href="http://opensource.org/licenses/ms-pl.html"&gt;Microsoft Public License (MS-PL)&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Architecturally, the Cmdlet Designer offers a reference implementation to benefit developers as well:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;UI on top of Cmdlets &lt;/li&gt;    &lt;li&gt;Script-based UI extensibility &lt;/li&gt;    &lt;li&gt;Cmdlet / Webservice interaction &lt;/li&gt;    &lt;li&gt;Role-based security, with a trusted subsystem implementation &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Download, and enjoy!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lee Holmes [MSFT]    &lt;br /&gt;Windows PowerShell Development     &lt;br /&gt;Microsoft Corporation&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9908317" width="1" height="1"&gt;</description></item><item><title>Introducing the Windows 7 Resource Kit PowerShell Pack</title><link>http://blogs.msdn.com/powershell/archive/2009/10/15/introducing-the-windows-7-resource-kit-powershell-pack.aspx</link><pubDate>Thu, 15 Oct 2009 20:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907842</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>13</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9907842.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9907842</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9907842</wfw:comment><description>&lt;P&gt;Since I work on the PowerShell team, I’ve been lucky enough to get a couple of years jump start on producing PowerShell V2 scripts and modules.&amp;nbsp; With every new script I write in V2 I get more and more amazed by the possibilities in PowerShell.&amp;nbsp; I’ve discovered how to do many cool things that, as some of my colleagues outside of the PowerShell team have put it, have showed them the Power of PowerShell.&lt;/P&gt;
&lt;P&gt;At each CTP of PowerShell, I’ve tried to share this power of PowerShell here on this blog.&amp;nbsp; Thanks to &lt;A href="http://www.mtit.com/" mce_href="http://www.mtit.com/"&gt;Mitch Tulloch&lt;/A&gt; (the main author of the Windows 7 Resource Kit) and Ed Wilson (&lt;A href="http://blogs.technet.com/heyscriptingguy/" mce_href="http://blogs.technet.com/heyscriptingguy/"&gt;the Scripting Guy&lt;/A&gt;), I was able to collect some of my V2 modules for the companion CD of the resource kit.&amp;nbsp; This collection of scripts became know as the Windows 7 Resource Kit PowerShell Pack.&lt;/P&gt;
&lt;P&gt;Today, the &lt;A href="http://www.microsoft.com/learning/en/us/Books.aspx?Id=13811&amp;amp;locale=en-us" mce_href="http://www.microsoft.com/learning/en/us/Books.aspx?Id=13811&amp;amp;locale=en-us"&gt;Windows 7 Resource Kit&lt;/A&gt; should be available in stores, and the &lt;A href="http://code.msdn.microsoft.com/PowerShellPack" mce_href="http://code.msdn.microsoft.com/PowerShellPack"&gt;PowerShell Pack&lt;/A&gt; is available for download on code gallery.&lt;/P&gt;
&lt;P&gt;The PowerShell Pack contains over 800 scripts in 10 different modules.&amp;nbsp; Here’s a brief overview:&lt;/P&gt;
&lt;P&gt;&lt;B&gt;WPK&lt;/B&gt; &lt;BR&gt;Create rich user interfaces quick and easily from Windows PowerShell. Think HTA, but easy. Over 600 scripts to help you build quick user interfaces.&amp;nbsp; To get started learning how to write rich WPF UIs in script, check out &lt;A href="http://code.msdn.microsoft.com/PowerShellPack/Release/ProjectReleases.aspx?ReleaseId=3343" mce_href="http://code.msdn.microsoft.com/PowerShellPack/Release/ProjectReleases.aspx?ReleaseId=3343"&gt;Writing User Interfaces with WPK&lt;/A&gt;.&lt;/P&gt;&lt;B&gt;IsePack&lt;/B&gt; &lt;BR&gt;Supercharge your scripting in the Integrated Scripting Environment with over 35 shortcuts. 
&lt;P&gt;&lt;STRONG&gt;TaskScheduler&lt;/STRONG&gt; &lt;BR&gt;List scheduled tasks, create or delete tasks &lt;/P&gt;
&lt;P&gt;&lt;B&gt;FileSystem&lt;/B&gt; &lt;BR&gt;Monitor files and folders, check for duplicate files, and check disk space &lt;/P&gt;
&lt;P&gt;&lt;B&gt;DotNet&lt;/B&gt; &lt;BR&gt;Explore loaded types, find commands that can work with a type, and explore how you can use PowerShell, DotNet and COM together &lt;/P&gt;
&lt;P&gt;&lt;B&gt;PSImageTools&lt;/B&gt; &lt;BR&gt;Convert, rotate, scale, and crop images and get image metadata &lt;/P&gt;
&lt;P&gt;&lt;B&gt;PSRSS&lt;/B&gt; &lt;BR&gt;Harness the FeedStore from PowerShell &lt;/P&gt;
&lt;P&gt;&lt;B&gt;PSSystemTools&lt;/B&gt; &lt;BR&gt;Get Operating System or Hardware Information &lt;/P&gt;
&lt;P&gt;&lt;B&gt;PSUserTools&lt;/B&gt; &lt;BR&gt;Get the users on a system, check for elevation, and start-processaadministrator &lt;/P&gt;
&lt;P&gt;&lt;B&gt;PSCodeGen&lt;/B&gt; &lt;BR&gt;Generates PowerShell scripts, C# code, and P/Invoke &lt;/P&gt;
&lt;P&gt;I’ll be posting a lot more about these modules in the next weeks, both here and on Channel9, but you can start exploring the modules now by checking out the &lt;A href="http://code.msdn.microsoft.com/PowerShellPack" mce_href="http://code.msdn.microsoft.com/PowerShellPack"&gt;PowerShellPack on code gallery&lt;/A&gt;.&amp;nbsp; I will also be &lt;A href="http://twitter.com/jamesbru" mce_href="http://twitter.com/jamesbru"&gt;tweeting&lt;/A&gt; some cool tidbits about the PowerShell Pack under the tags: #PowerShellPack, #WPK and #IsePack&lt;/P&gt;
&lt;P&gt;I’ll also be on Hal Rotenberg’s &lt;A href="http://www.powerscripting.net/" mce_href="http://www.powerscripting.net/"&gt;PowerScripting Podcast&lt;/A&gt; tonight talking about the &lt;A href="http://code.msdn.microsoft.com/PowerShellPack" mce_href="http://code.msdn.microsoft.com/PowerShellPack"&gt;PowerShell Pack&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;James Brundage [MSFT]&lt;/P&gt;
&lt;P&gt;Quick Note: The MSI was updated at ~ 4:30pm on day of release. If you downloaded it before this time, please download the MSI again.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907842" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/powershell/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/powershell/archive/tags/PowerShellPack/default.aspx">PowerShellPack</category><category domain="http://blogs.msdn.com/powershell/archive/tags/WPK/default.aspx">WPK</category></item><item><title>Understanding the Feedback Process</title><link>http://blogs.msdn.com/powershell/archive/2009/09/30/understanding-the-feedback-process.aspx</link><pubDate>Wed, 30 Sep 2009 21:19:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9901439</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9901439.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9901439</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9901439</wfw:comment><description>&lt;p&gt;During the development of any product, the vision for the upcoming release is driven by the desire to help as many customers in the most effective way possible.&lt;/p&gt;  &lt;p&gt;One of the interesting aspects of a release is balancing the effort you spend on different aspects of that project:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;New features and broad changes designed to address significantly new customer scenarios. &lt;/li&gt;    &lt;li&gt;Feature updates and incremental changes designed to improve scenarios already (or partially) addressed by existing features. &lt;/li&gt;    &lt;li&gt;Bug fixes designed to address functionality that doesn’t work as designed. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;When weighing these factors, a critical factor is &lt;i&gt;customer importance&lt;/i&gt;. Aggregate customer needs (and user research) heavily influence the first bucket, so the customer impact there is clear. The second two buckets come by way of direct customer feedback and bug submissions: &lt;a href="http://connect.microsoft.com/powershell"&gt;http://connect.microsoft.com/powershell&lt;/a&gt; and pose a more difficult problem.&lt;/p&gt;  &lt;p&gt;When looking at a piece of feedback in isolation, the customer impact is difficult to judge. While it is clear that the original feedback submitter ran into the problem, are they the only one to have run into it? Clearly, bugs and feedback that have broad customer impact are easy decisions to make when your goal is maximum value for the customer. Conversely, bugs and feedback that have little customer impact shouldn’t disrupt the features, feedback items, and bug fixes that do.&lt;/p&gt;  &lt;p&gt;We’ve updated our Connect site to make this process as clear as possible:&lt;/p&gt;  &lt;p align="center"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/powershell/WindowsLiveWriter/UnderstandingtheFeedbackProcess_9F2E/clip_image002_3.jpg" width="628" height="195" /&gt;&lt;/p&gt;  &lt;p&gt;If you are impacted by an issue, following those directions is the most constructive way to make your feedback known.&lt;/p&gt;  &lt;p&gt;&lt;i&gt;The key point here is that customer impact drives our decisions&lt;/i&gt;. You are the key for helping us determine customer impact. &lt;i&gt;A vote for an existing bug or feature request is just as impactful (if not more!) than the original submission.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;If you are impacted by an issue or have a suggestion, please visit &lt;a href="http://connect.microsoft.com/PowerShell"&gt;http://connect.microsoft.com/PowerShell&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Lee Holmes [MSFT]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9901439" width="1" height="1"&gt;</description></item><item><title>What's Up With Command Prefixes?</title><link>http://blogs.msdn.com/powershell/archive/2009/09/20/what-s-up-with-command-prefixes.aspx</link><pubDate>Sun, 20 Sep 2009 21:34:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9897302</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9897302.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9897302</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9897302</wfw:comment><description>&lt;p&gt;We like to say that PowerShell uses Verb-Noun naming.&amp;#160; If we were accurate, we would say that PowerShell uses Verb-&lt;strong&gt;Prefix&lt;/strong&gt;Noun naming.&amp;#160; For instance: Get-WinEvent .&amp;#160; WIN is a prefix for Windows.&amp;#160; Every now and again people look at this and ask “&lt;em&gt;&lt;strong&gt;what's up with command prefixes ?!?&lt;/strong&gt;&lt;/em&gt;”.&amp;#160; Actually, the question usually comes from teams that are implementing Cmdlets and don't understand why they have to use prefixes.&amp;#160; They sometimes feel like their noun is unique or they want to own the noun or they think they may get reorganized into a different group so they are not sure what a good prefix would be (hey - is a legitimate issue for some teams – it just has nothing to do with the customer.)&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;Prefixes mitigate naming collisions.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Consider the case of the recent cmdlet Get-WinEvent which was developed by the Windows Diagnostics team (the same great team that brought you the super awesome W7 troubleshooting [which uses PowerShell heavily]).&amp;#160; What would've happened if they'd just called it Get-Event.&amp;#160; The PowerShell team needed to use the name Get-Event Cmdlet (I'll explain why it doesn't use a prefix later) so without a prefix these two Cmdlet names would collide.&amp;#160; So what happens with a collision?&amp;#160; Well one wins and the other loses.&amp;#160; Specifically, last writer wins.&amp;#160; So if you had a script that uses Get-Event, it is going to use would ever last defined that name.&amp;#160; In other words your script will break.&amp;#160; &lt;/p&gt;  &lt;p&gt;(NOTE: For the record – the story is much more complicated that that.&amp;#160; The Diag team used the name “Get-Event” first and we OKed it with them and then sometime later we got crisp about our policy for when PowerShell needs to own generic nouns and made them change it.&amp;#160; It was an unfortunate situation and the diag team ended up “taking one for the team” and doing a bunch of extra work so that we could deliver a great customer experience. We all owe them a big THANK YOU.)&lt;/p&gt;  &lt;p&gt;No matter what we do, naming collisions will occur so let's talk about how you deal with that when it happens.&amp;#160; The solution is simple, you use the full Cmdlet name.&amp;#160; &lt;strong&gt;Full&lt;/strong&gt; Cmdlet name?&amp;#160; Yes that's right, every Cmdlet that has a short and a full name.&amp;#160; The names you use all day long are the &lt;strong&gt;short&lt;/strong&gt; Cmdlet names.&amp;#160; The full name Get-WinEvent is Microsoft.PowerShell.Commands.Diagnostics\Get-WinEvent.&amp;#160; That’s right, if anyone comes along and collides with Get-WinEvent, you just go change all your scripts to use Microsoft.PowerShell.Commands.Diagnostics\Get-WinEvent.&amp;#160; OUCH!&amp;#160; Clearly this is an undesirable situation but at the end of the day these things happen so you have to have a solution.&amp;#160; That said, it should be obvious why we want to avoid collisions as much as possible.&lt;/p&gt;  &lt;p&gt;Think through the problem.&amp;#160; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;There are lots of things that need to be named.&lt;/li&gt;    &lt;li&gt;Everything has to have a universally unique name.&amp;#160; This either means a GUID or long human readable name.&lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;e2454d24-a4d9-4d41-b514-7b81f4257b64&amp;#160; vs. Microsoft.PowerShell.Commands.Diagnostics\Get-WinEvent &lt;/li&gt;   &lt;/ol&gt;    &lt;li&gt;You want to have short names and use them whenever possible.&amp;#160; In other words you want to avoid having collisions that require you to use the universally unique name.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;When we thought through this problem we made some guesses about how many things needed to be named.&amp;#160; It's been many years since we had the discussion but I believe the numbers were something like this:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;We expected there'd be hundreds of thousands of Cmdlets in the industry.&lt;/li&gt;    &lt;li&gt;A large customer shop might have the 30-50 thousand Cmdlets running on all machines in their enterprise.&lt;/li&gt;    &lt;li&gt;Any particular machine might have 1-5 thousand Cmdlets on it.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The key observation here was that we had to minimize the possibility of short names colliding on a particular machine (not a customer site or the industry).&amp;#160; &lt;/p&gt;  &lt;p&gt;Verb names are meant to be standard so they're always going to collide - that's a good thing (because it means you can guess which you want to do in your guess will be correct).&amp;#160; So this is really an issue of increasing the &lt;a href="http://en.wikipedia.org/wiki/Hamming_distance"&gt;Hamming Distance&lt;/a&gt; of noun names.&amp;#160; Adding a 2-4 character prefix (indicating the team or product that owns the noun) in front of the noun solves this problem.&amp;#160; &lt;/p&gt;  &lt;table border="2" cellspacing="0" cellpadding="2" width="529"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="134"&gt;&amp;#160;&lt;/td&gt;        &lt;td valign="top" width="178"&gt;Chance of Collision         &lt;br /&gt;Without a prefix&lt;/td&gt;        &lt;td valign="top" width="213"&gt;Chance of Collision          &lt;br /&gt;With a prefix&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="135"&gt;Industry&lt;/td&gt;        &lt;td valign="top" width="177"&gt;Absolute&lt;/td&gt;        &lt;td valign="top" width="213"&gt;High&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="136"&gt;Large IT shop&lt;/td&gt;        &lt;td valign="top" width="177"&gt;Very High&lt;/td&gt;        &lt;td valign="top" width="212"&gt;Low&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="137"&gt;Machine&lt;/td&gt;        &lt;td valign="top" width="177"&gt;High&lt;/td&gt;        &lt;td valign="top" width="212"&gt;Very Low&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;NOTE:&amp;#160; The side benefit of using prefixes is that it provides an easy way to find all the commands from a particular source.&amp;#160; For instance, the Active Directory team chose the prefix “AD” so you can type:&amp;#160; Get-Command *-AD* to find all their Cmdlets.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So that is the reason why we are hardcore on the guidance to use prefixes in front of your noun names.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Oh wait, I promised to tell you why PowerShell sometimes doesn't use the prefix PS in its Cmdlets.&amp;#160; There are three reasons for this:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt; Writing the code has its privileges.&amp;#160; :-)&amp;#160; &lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;Certain nouns are going to be used all the time and PowerShell is always there (by definition) so we used our unique position to grab some names to deliver a good user experience.&lt;/li&gt;   &lt;/ol&gt;    &lt;li&gt;We use generic noun names whenever we provide the framework for other people to plug into.&amp;#160; &lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;We used the name Get-Event because our eventing system is an extensible subsystem that anyone can plug into.&amp;#160; Get-Event then provides a common front end to all those plugins.&amp;#160; This is also the case for JOB, ITEM, etc&lt;/li&gt;   &lt;/ol&gt;    &lt;li&gt;We screwed up.&lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;In V2, we used the PS prefix a lot but I don’t think we were as consistent as we could have been.&amp;#160; Certainly this was the case for V1 where there are a number of cmdlets that should have used the PS prefix.&amp;#160; Live and learn.&lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;But I hope this clarifies the importance of prefixing.&amp;#160; As a community it is in your best interest to enforce this standard quite getting grief to those teams and companies that don't adhere to it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Enjoy! &lt;/p&gt;  &lt;p&gt;Jeffrey Snover [MSFT]   &lt;br /&gt;Distinguished Engineer    &lt;br /&gt;Visit the Windows PowerShell Team blog at:&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;    &lt;br /&gt;Visit the Windows PowerShell ScriptCenter at:&amp;#160; &lt;a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9897302" width="1" height="1"&gt;</description></item><item><title>Remoting for non-Admins</title><link>http://blogs.msdn.com/powershell/archive/2009/09/20/remoting-for-non-admins.aspx</link><pubDate>Sun, 20 Sep 2009 03:41:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9897194</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9897194.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9897194</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9897194</wfw:comment><description>&lt;p&gt;Per Østergaard has a great blog entry with all the steps for enabling this &lt;a href="http://msgoodies.blogspot.com/2009/09/using-ps-session-without-having.html"&gt;HERE&lt;/a&gt;.&amp;#160; You’ll want to bookmark this one.&amp;#160; :-)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Enjoy! &lt;/p&gt;  &lt;p&gt;Jeffrey Snover [MSFT]   &lt;br /&gt;Distinguished Engineer    &lt;br /&gt;Visit the Windows PowerShell Team blog at:&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;    &lt;br /&gt;Visit the Windows PowerShell ScriptCenter at:&amp;#160; &lt;a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9897194" width="1" height="1"&gt;</description></item><item><title>Select –ExpandProperty &lt;PropertyName&gt;</title><link>http://blogs.msdn.com/powershell/archive/2009/09/14/select-expandproperty-propertyname.aspx</link><pubDate>Mon, 14 Sep 2009 04:04:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9894762</guid><dc:creator>PowerShellTeam</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/powershell/comments/9894762.aspx</comments><wfw:commentRss>http://blogs.msdn.com/powershell/commentrss.aspx?PostID=9894762</wfw:commentRss><wfw:comment>http://blogs.msdn.com/powershell/rsscomments.aspx?PostID=9894762</wfw:comment><description>&lt;p&gt;Most of us are familiar with the traditional use of Select –ExpandProperty &amp;lt;propertyname&amp;gt;.&amp;#160; This takes a the value of an incoming object, enumerates its values and outputs each of those values as a single record on the output stream after adding any properties specified by the –PROPERTIES &amp;lt;propertyname[]&amp;gt; parameter.&amp;#160; An example will help:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; gps |Select -ExpandProperty Modules -ea SilentlyContinue |Group ModuleName |Sort Count |Select -Last 4 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;Count Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Group     &lt;br /&gt;----- ----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -----      &lt;br /&gt;&amp;#160;&amp;#160; 58 kernel32.dll&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {System.Diagnostics.ProcessModule (kernel32....      &lt;br /&gt;&amp;#160;&amp;#160; 58 msvcrt.dll&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {System.Diagnostics.ProcessModule (msvcrt.dl...      &lt;br /&gt;&amp;#160;&amp;#160; 58 KERNELBASE.dll&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {System.Diagnostics.ProcessModule (KERNELBAS...      &lt;br /&gt;&amp;#160;&amp;#160; 72 ntdll.dll&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {System.Diagnostics.ProcessModule (ntdll.dll...&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;A while ago, Lee Holmes turned me on to another use of –ExpandProperty and I’ve been meaning to blog it ever since.&amp;#160; Have you ever wanted to get just the value for a property from every object?&amp;#160; You’d think you could do this and it would work:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; gps *ss |select name &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;Name     &lt;br /&gt;----      &lt;br /&gt;csrss      &lt;br /&gt;csrss      &lt;br /&gt;lsass      &lt;br /&gt;smss&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Sadly, this is not what you want. This gives you a set of objects each of which has exactly one property:&amp;#160; NAME.&amp;#160; What you wanted was a stream of VALUES.&amp;#160; What I’ve always ended up doing was this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; gps *ss | foreach {$_.Name}     &lt;br /&gt;csrss      &lt;br /&gt;csrss      &lt;br /&gt;lsass      &lt;br /&gt;smss&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This works, it is not too hard but it always sorta pissed me off that I had to do it this way.&amp;#160; Sadly, addressing this never made it above the cut like for V2.&amp;#160; Again – to ship is the choose.&amp;#160; I was complaining about this one day and Lee pointed out that if you specify a scalar property (a property that is NOT a collection) for –ExpandProperty – it gives you exactly what you want.&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; gps *ss |select -ExpandProperty name     &lt;br /&gt;csrss      &lt;br /&gt;csrss      &lt;br /&gt;lsass      &lt;br /&gt;smss&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;SWEET!&lt;/p&gt;  &lt;p&gt;Enjoy! &lt;/p&gt;  &lt;p&gt;Jeffrey Snover [MSFT]   &lt;br /&gt;Distinguished Engineer    &lt;br /&gt;Visit the Windows PowerShell Team blog at:&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;    &lt;br /&gt;Visit the Windows PowerShell ScriptCenter at:&amp;#160; &lt;a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9894762" width="1" height="1"&gt;</description></item></channel></rss>