Hopefully this is just a reminder to you that on April 1st, 2009, Microsoft is putting on TechDays, a free 24 hour virtual event covering dozens developer-related topics with speakers around the globe…
There will be around 100 live sessions provided via Live Meeting (and available afterward for watching on-demand) in five tracks:
MS MVP Marco Shaw will be presenting the only session specifically covering Windows PowerShell: WIN300 Scripting the Microsoft .NET Framework Using Windows PowerShell.
Now that PowerShell is part of the Microsoft Common Engineering Criteria, expect to see more and more PowerShell in Microsoft server products. This session looks at how PowerShell can be used to directly access the .NET Framework. Some simple examples are demonstrated, but also more advanced examples of using Windows Presentation Foundation (.NET 3.0) and LINQ (.NET 3.5) are discussed.
In any case, the whole event is free, and you can participate from the comfort of your desk! It’s a FREE event, so you really shouldn’t miss it: you get a chance to win one of several MSDN Premium subscriptions, as well as some discounts on Certification Exams…
I wrote a demo awhile back which I shared with a few people, but never really published, except in video form.
I figured it’s past time to share the actual script. It’s written using PowerBoots, and I actually wrote a version of it for PowerShell 1.0 and another for PowerShell 2.0 to show how much cleaner the syntax can be once you have the generated functions which currently only work in PowerShell 2.0 …
I’d comment here, and point out the ugliness of the version 1 script by comparison, but really what I want you to catch is the fact that you can pop out a window, continue using your PowerShell host, and still do more things to it, like adding additional hosts to our ping time monitor. Point being: the script is just a demo of things that can be done — not an example of how you should write code, nor a great working monitor (it’s far too large on the screen to leave running all the time, in my opinion
).
I had to submit a bug to the Visual Studio connection this week and was pleasantly surprised, even astonished, at how easy their site is to use compared to PowerShell’s.
First of all, their connection URL is: https://connect.microsoft.com/VisualStudio … as opposed to the PowerShell connection, which has the url: https://connect.microsoft.com/site/sitehome.aspx?SiteID=99 …
Secondly, I could search and view bugs without ever logging in!
And finally, imagine my shock when I found that I could actually SUBMIT a bug without “joining” their “Connection” ... all I had to do was log in to Live. All this time I thought the whole “membership” clique was just a built-in requirement for Connect.
Now, I don’t know any of the reasons why PowerShell’s connection is so limited, but I presume it’s mostly because it was initially set up as a closed pre-release testing connection and has never been “fixed.” Well, it’s time to get this thing fixed.
Oh, and if anyone from the PowerShell or Connect team is reading this … you should make the PowerShell Connect front page look like the Visual Studio one too. PowerShell’s front page is a duplicate of a long blog post from the release of the last CTP — Visual Studio’s is a series of very informative button-links which help you figure out what to do next (eg: there’s a “Bug” link, instead of just a link to “Feedback”).
Someone asked (on Twitter) about using WatiN from PowerShell, and pointed to this old post by Scott Hanselman saying he was having the same problems … so I wrote this to help them out:
Note: WatiN requires Single Threaded Apartment mode, so you need to be using PowerShell 2.0 (currently in CTP3) in order for any of this to work, and you need to pass the -STA parameter to PowerShell. Regardless, I thought I’d throw two tips out here:
LoadFile, use LoadFromI’m not 100% sure when it’s appropriate to use LoadFile in PowerShell, but I can tell you that if your assembly is in a folder with a bunch of other assemblies upon which it depends … you need to use [Reflection.Assembly]::LoadFrom( $path ) instead — because the .net loader will be able to find the dependencies.
It’s trivial to do code-generation in PowerShell, and WatiN is not friendly to the PowerShell syntax, so you’re going to want to generate a bunch of them. To get you started, here’s a set of Find-* functions to let you find each type of element that WatiN recognizes and automates… by name, id, class, style … well, by any attribute, really:
Read the rest of this entry »Well, over the weekend I stole a few moments from thinking about PoshCode 2.0 to think about PoshCode 1.0 … and I added two things:
I’ve replaced the misused “comment” box on the website with a full GetSatisfaction.com widget, so you can get your voice heard and get feedback (in the past it’s been impossible for me to respond to comments).
PoshCode now posts new contributions to twitter on it’s own PoshCode account. Feel free to follow along. Of course, the information on there is severely truncated, by comparison with the PoshCode RSS feed … and only includes the link to the website, whereas the RSS feed also includes direct download links … but I figured some of you would appreciate it anyway, and I aim to please.
Of course, now in PoshCode 2 I’ll have to make sure we have users enter their twitter id’s in the profile page so we can be sure to cite you properly. Oh what a tangled web we weave…
Someone asked on the PowerShell Newsgroup about writing Advanced Functions, and specifically:
looking for a … guide to putting together an advanced function that is visible and usable every time I start Powershell. By visible I mean that when I do a ‘get-command’ I want my [advanced function]s to be listed alongside all the regular cmdlets. What makes that possible? ... what do I need to do to make that happen? Whats the difference between an [advanced function] and a module?
There are lots of articles on the Microsoft PowerShell team blog about both topics, but it seems there’s not really been any sort of step-by-step written, so I posted this to the newsgroup, and since the person who asked the original question said he found it useful, I figured I’d share it here…
Read the rest of this entry »