Friday, April 24, 2009

Windows Management Infrastructure Blog

The WMI team are now blogging in the Windows Management Infrastructure Blog. A most useful blog for those wanting to understand WMI (and BITS, and WINRM) especially those coming to this from a PowerShell point of view. One interesting post examines the WMI story, pre Windows 7 (with lots of great links to more background). Another post looks at what is coming with WMI in Windows 7 (i.e. with PowerShell V2).

This blog is well written! And any blog that can mix PowerShell, reindeers, Jedis, ands and grasshoppers can’t be all bad!

Technorati Tags: ,,

PowerShell and CMDlet design guidelines.

Dan Harman, a PM in the Windows PowerShell team has published an excellent blog article: Increasing visibility of cmdlet design guidelines. The article talks about cmdlet naming conventions and the importance of good naming around the verbs and nouns used in the names of cmdlets (and by implication advanced functions too). The article also talks about the problems of a proliferation of uses of PowerShell that deviate from the standards currently being set by the PowerShell team.

With the increasing adoption of PowerShell across MS and non-MS products, standards are vital and enforcement probably mandatory. PowerShell aims help organisations break down their knowledge silos. To achieve this, there needs to be a standard set of verbs and nouns you can use and some good way of enforcing it.

Microsoft proposes some changes to V2 to resolve the issue. Specifically, when you call Import-Module to import cmdlets, Powershell evaluates the module and warns against violations of the standards. The end use sees a warning message but the cmdlets are still imported. Thus, by default, when you load a module with badly named cmdlets, you get a warning message but everything works (i.e. the module is imported!). For scripts where you want to suppress the Warning, just use the –DisableNameChecking on the call to Import-Module.

This is a pretty neat solution. We’ve already seen a number of interesting approaches to the use of PowerShell by various teams, and MS is right to want to stop the problem from being a real problem.

One addition I’d like to see: a GPO setting to set a default value to enable disabling name checking. The scenario I envisage is an organisation that has, for whatever reason, invested in cmdlets that end up being badly named. Rather than have their admins constantly be reminded, or worse possibly confused, I’d like to see a GPO setting to always just not show the message for my organisation (or part of an organisation).

Technorati Tags:

Wednesday, April 22, 2009

Saying Thanks

I’ve been posting here to this blog for a few years – and on occasion, I get a nice comment either here on the blog or in email. In September 2006, I published an article entitled Vista Shortcut keys where I described the new short cut keys you can use with Vista.  Well today, I got a comment on the blog – it wasn’t much, just a short “thanks” but it sure made my day!

Technorati Tags:

Hey Scripting Guy! Windows Powershell and Pipelining

Just saw a new article from The Scripting Guys (aka  Ed Wilson and Craig Liebendorfer). Entitled “Hey Scripting Guy! Windows Powershell and Pipelining”, this article looks at the PowerShell pipeline. It’s a 100-200 level article, but may be helpful to learn more about the pipeline.This article is one of many that The Scripting Guys pump out – for a complete list, by date, see: http://www.microsoft.com/technet/scriptcenter/resources/qanda/all.mspx. There are 18 articles already for April.

The Scripting Guys Rock! You can also follow them on Twitter: http://twitter.com/scriptingGuys

Tuesday, April 21, 2009

PowerShellASP - Build dynamic web content with PowerShell!

This is pretty cool – integration of ASP.NET and PowerShell.  PowerShellASP is an ASP-like template language for Web Applications. You create templates that contain a mixture of mark-up i.e. (HTML, XML or whatever) plus inline PowerShell code. At runtime, your templates/pages are translated to PowerShell code and executed as a single unit inside a PowerShell pipeline. The results are then sent to the client browser.

Setting it up is easy too: see http://www.powershelltoys.com/configuration.aspx. Simple!

Technorati Tags: ,

Fun and Games with WMI and PowerShell

As I continue to dive deeper into PowerShell WMI, I continue to be surprised by new things I discover. I’ve been playing today with the WMI Class WIN32_printer. Sometime ago, I posted a code sample over on MSDN using this class with Powershell (see the original sample here).

The original sample produced a test page on a specific printer – but I thought it would be interesting to see what happened if I ran the script against ALL the printers define on my workstation. And that got interesting.

On my system, I have two ‘real’ printers installed (a colour Inkjet and a colour  laser) and two additional printers: an XPS Document Writer “printer” and a SnagIt 9 “printer”. As expected, the real printers printed their test pages just fine. But the virtual printers did not fare so well. The SnagIt printer failed to print a test page. It generated two “Unable to open message queue” error messages (in a pop-up window), then failed with a message “Unable to send a message to SnagIt” (and another pop-up). But at least it failed gracefully although the Result code was 0. Attempting to print to the XPS document writer just hung.

This result shows that, at least with WMI (and probably ALL other classes), when you start writing scripts based on base objects (i.e. WMI, COM, .NET and home grown), you need to know what you are doing. And in writing production scripts, you need to be extra careful with testing, and coding around the problem issues.

This last point is illustrated in the updated script that I published to my scripts blog: http://pshscripts.blogspot.com/2009/04/get-printertestpageps1.html. Look at lines 63-65 – these avoid calling the PrintTestPage on those printers you know to not work. This is another interesting reference to the fact that production scripting is more about “error” handling (you might call it “reality handling” too"!) than anything else. And a lot of wide testing.

Technorati Tags: ,,

Wednesday, April 15, 2009

Master-PowerShell by Dr. Tobias Weltner

As a PowerShell addict, I love sharing information about the product. I’ve just seen that Dr Tobias Weltner has finished off an e-book, entitled Master-PowerShell. This book is a free, 20-chapter work covering all aspects of PowerShell and is targeted at PowerShell Version 1. Thus, no details on Modules, remoting, etc, but nevertheless containing lots of useful information. I especially enjoyed reading Chapter 18 and learning more about PowerShell and WMI!

I recommend this book!

Master-PowerShell | With Dr. Tobias Weltner - PowerShell.com

Tuesday, April 14, 2009

Rich Copy – A Must Have Application

A very long time ago, when I was contracting for Microsoft, I got a copy of a cool internal application called Rich Copy – sort of a RoboCopy on steroids. The Internally obtained version of Rich Copy timed out after a while which was a shame.But today, I’ve just read that Rich Copy is available for download from the TechNet site: http://technet.microsoft.com/en-us/magazine/2009.04.utilityspotlight.aspx. This is a very seriously cool app – and it’s free and freely available.

Technorati Tags: ,,

Monday, April 13, 2009

Microsoft Office Protocol Documents – Geek Heaven

I’m just back to the UK after a month on the road, topped off by a week in Redmond attending an OCS Voice Ignite Train-The-Trainer session. Last week was a week in geek heaven. We spent a lot of time exploring the inner workings of OCS. In particular, how OCS operates on the wire – both between servers and between client and server. Fascinating stuff – sheer geek bliss.

Both last week and in my Voice Ignite classes, I see huge interest around how MS has implemented SIP on the Wire within OCS.  When looking at OCS wire captures, or SIP logs, you can see a huge number of Microsoft extensions to older style SIP traffic, in addition to the updates to both SDP and RTP. In preparing for my upcoming TechEd talk (SIP – Naked in all it’s Glory), understanding these better has taken on a new importance.

Whilst in Redmond, superstar VI Trainer Dennie Klama pointed me towards updates to the Microsoft Office Protocol Documents.  I first came across these last summer, as noted in a blog entitled: Open Geek Goodness From Microsoft.  It was cool to get access to this level of detail – although I was disappointed that the documents themselves were not open to Community Content on the MSDN site. Thus there was no way for the community to clarify or perhaps better document the details of the protocol. I’d love to see more real-world examples to illustrate the text better.

Thanks to the pointer from Dennis, I was very exited to see not only more documents than I recall seeing last July, but much more importantly, there have been updates to these documents. The most recent set of updates to the OCS related documents I’ve read so far occurred in March 2009.

You can browse the index to the OPDs on the TechNet site at: http://tfl09.blogspot.com/search?q=protocols. You can also download a zip file of all 61 documents from: http://go.microsoft.com/fwlink/?LinkId=112500.

If you want to understand what OCS is doing on the wire, these documents are a must read.

Wednesday, April 01, 2009

Microsoft accepts defeat to Wikipedia and kills off Encarta

Today’s news that Microsoft accepts defeat to Wikipedia and kills off Encarta, which I read in the on-line version of The Times, is quite sad. But it’s one data point in the huge shift we’re seeing from the older style printed material (and that includes CD/DVDs) to online only.

We’ve seen a number of newspapers stop publishing their print editions, and a magazine I wrote for (Server Management Magazine), I contributed for over 10 years, has also gone web only. Although Encarta was an on-line product too, the death of print media is continuing at a pretty frantic pace.

One could argue the battle was more about the content than online vs offline. For me at least, the content on Wikipedia is very good. Thinking  back over the past year, when I needed information, I’ve tended to use Google and Wikipedia. In a few cases, I found Wikipedia entries wanting – so I added some content. Maybe if MS had opened Encarta up more, it’s popularity might have been higher.

As it turns out, Encarta was a very distant 2nd place to Wikipedia. With Wikipedia having 97% market share and Encara being second with 1.27% (and “print” not being significant0, the decision was only a matter of when, not whether.

So farewell Encarta.

Technorati Tags: ,