PowerShell Team
Automating the world one-liner at a time…
Latest posts
Changes in upcoming CTP
In my earlier blog, I mentioned that we had changed things since the previous CTP. Rather than leave everyone wondering whether they were doomed or not, I decided to have an early release of that portion of the release notes. Here they are: Breaking Changes to Windows PowerShell 1.0 1. The value of the PowerShellVersion registry entry in HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine has been changed to 2.0. 2. Added new language keywords: Data, Cmdlet, and DynamicParam. Any commands called data, cmdlet or dynamicParam are interpreted as language keywords and result in pa...
How Could You Top CTP1?
(Did I give it away by putting the "1" next to the CTP?) Well put your seatbelts on baby because CTP2 is in the cooker and will be available sometime soon. I'm writing this note to remind everyone of what a CTP is and is not. The original CTP: Watch this Space blog is worth re-reading. Wait, let me be more precise - go read that blog again. Do you remember PROMISED that we'd listen and act upon (a subset of) your feedback and that that meant that things would change? Well we got some great feedback and have made a bunch of changes. I think you are going to ...
Management & Services Division (MSD)
We recently did a short internal "who are we" video about our organization (MSD). I don't know how it got out into the wild but you can check it out over on YouTube HERE. It's 3 minutes, fun and there are a couple scenes of me saying things that are either really stupid or really clever. (seemed clever at the time but upon viewing ... well... :-) ) Jeffrey Snover [MSFT] Windows Management Partner Architect Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/techne...
$MindWarpingPower = $Cmdlets + $ScriptBlock_Parameters
A while ago I blogged about the power of Flexible Pipeling Scriptblock parameters. The mechanics of this are quite simple: In a pipeline environment, if you provide a SCRIPTBLOCK to a parameter which does not take a SCRIPTBLOCK or an OBJECT, the PowerShell engine assigns the current pipeline object to the variable "$_", runs the scriptblock and uses whatever value it returns for the value of that parameter. Looking back at this, I don't think we've done a good enough job explaining it or promulgating its use because it is incredibly powerful and I just don't see it being used...
WMI Object Identifiers and Keys
Recently one of MVPs, Darren Mar-Elia (Group Policy Guru from SDMSoftware [which as a set of FREE PowerShell GP cmdlets HERE]) was working with our WMI type accelerators and got the following error: $ld = '\\sdmlaptop1\root\cimv2:Win32_LogicalDisk.Caption="C:"' $disk = [WMI] $ld Cannot convert value "\\sdmlaptop1\root\cimv2:Win32_LogicalDisk.Caption="C:"" to type "System.Management.ManagementObject". Error: "Invalid object path " At line:1 char:17 + $disk = [WMI] $ld <<<< This is a great opportunity to discuss WMI Key properties. WMI is an awesome piece of infrastructure. It has a ri...
PowerShell Running Inside of Emacs
Dino Chiesa has a couple of blogs showing how he was able to get PowerShell running as an "inferior shell" within Emacs. Apparently "inferior shell" is an emacs term of art and not a dig at PowerShell :-). I've always respected the all consuming nature of emacs and the love it has from its users. I used to joke that "emacs isn't an editor, it was a way of life". Emacs lovers log into emacs and that is where they hang out - all day. They can do almost everything from within emacs. Well know Dino shows how they can hang out in emacs and run PowerShe...
IIS 7.0 PowerShell Support
Quite a few people have expressed disappointment about the lack of IIS cmdlets or namespace provider. It's been a long sad tale. It turns out that the IIS team (and Sergei Antonov in particular) was one of the first groups to truly "get" PowerShell. I can't tell you how many teams, in the early days, looked at us like we had a rat's tail hanging out of our mouth. The IIS team embraced PowerShell early and did a great prototype of a namespace provider. Actually, now that I think about it, I think they were the first group to ever do a namespace provider. Things...
Managing Datacenter Machine Names
One of the first things managers of large scale datacenter do is to produce a regular naming scheme for their servers. These often embed the function, location, and then an integer. e.g. IIS-West-001 IIS-West-002 ... IIS-West-234 or ShareP-Tuk-001 ShareP-Tuk-002 ... ShareP-Tuk-010 PowerShell's range operator is awesome for working with these environments. If you haven't already discovered it, the Range Operator is .. - it takes any 2 integers and generates all the numbers between them (including them). An example is worth a thousand words: PS>1..3 1 2 3 ...
-ErrorAction update
Responding to my blog entry on -ErrorAction HERE, Jon Newman reminded me that the reason we didn't use the term IGNORE for -ErrorAction was that we don't really ignore the error. We still record it in $ERROR. He also reminded me that I should have talked about $ErrorActionPreference. This variable defines the action that will occur if the user does NOT specify what to do on the commandline. Check it out: PS>$ErrorActionPreference Continue PS>Stop-Process 13,23 Stop-Process : Cannot find a process with the process identifier 13. At line:1 char:13 +...