There are lots of things to consider when writing an advanced function in PowerShell depending on what the function will be designed to accomplish, what operating system and PowerShell versions it will be written for, and who will be using it. During this session, PowerShell MVP Mike F Robbins will walk you through the top 10 items that he takes into consideration along with his thought process when creating advanced functions in PowerShell. We’ll briefly discuss comment based help, parameters, parameter validation, pipeline input, and error handling. This will NOT be a deep dive into any one of these topics as the focus of this session will be on writing advanced functions to maximize code reusability by minimizing static values. Prior experience with PowerShell is recommended.
I wanted to call your attention to Smarterer, a company recently acquired by my employer, Pluralsight. Smarterer’s schtick (apart from vexing my auto-correct) is that the host crowdsourced technology assessments. In other words, the community decides what questions to ask someone in the test. The magic is that their back-end engine, over time, figures out which questions are awesome and which ones suck, and adjusts the assessment accordingly. So as more people (especially qualified ones) take the test, the better it gets at identifying skilled people. It gives it a sort of built-in immunity against bad community-contributed questions, because those eventually filter out of the assessment that’s delivered to people. It’s pretty engaging, actually. I’ve had some fun taking some web development-oriented assessments, and surprised myself in a few places. They’ve got a PowerShell assessment. Why not jump in, take it, and then add some questions of your own? Next time you need to interview someone for PowerShell chops, send ’em to Smarterer.
In honor of National Novel Writing Month (NaNoWriMo), I wanted to offer a smaller, and more unique, challenge. Send me a PowerShell article. Seriously. My name is Don Jones, and this is PowerShell.org, so you can probably figure out how to contact me. Send me an article between 800 and 3,000 words (including code) in Microsoft Word format. Don’t attach any scripts. Please keep the formatting super-simple: paste code from the PowerShell ISE, and use Word’s default styles otherwise. If you must include screen shots, please embed them in the doc, but also include them as a a separate PNG in your e-mail. You can write about anything, provided it’s PowerShell-related._ _What’s best? Some challenge that stumped you - and that you eventually solved (and please, tell us how). Something that you think folks could benefit from, or could learn to do better. Even an article that lays out both sides of a particular question, and outlines the pros and cons of each argument. Doesn’t matter. What matters is that you write. _ I will
personally
commit to reading every single one, and providing you with feedback on your article. When suitable, I’ll make some specific suggestions for improving the article. If you then fix it up accordingly, I’ll run it by a professional editor - and I’ll have it published. _In some cases, we’ll publish it right here on PowerShell.org. In other cases, I’ll submit it to my friends at 1105 Media for their consideration in one of their IT magazines, like Redmond Magazine or MCPMag.com. Still others will go into the PowerShell.org TechLetter, which would be a huge help to our editors, who are always hungry for content. Being able to communicate well is important in all walks of life, but being willing to share is even more important. Think you’ve got nothing to share? _Wrong. _You have unique experiences that everyone can learn from. You do not need to be an expert in order to have something valuable to share. We would all benefit a lot more if more people shared their experiences and successes - so now it’s your turn. The deadline is November 30th, of course, and I’ll work my way through them all as quickly as possible. You’re not going to be judged on your grammar or spelling (although do use Word’s tools to help those as much as it can). Don’t try to write fancy, or overly formal. In fact, just write like you’d talk. Read your piece back to yourself _aloud, _and if it sounds weird, fix it so it doesn’t. If it sounds good, it’ll read well. C’mon. Take up the challenge. And tweet folks over to this article, too. Let’s make it a thing. My goal is to help at least a few folks because regular bloggers, either here or elsewhere, and my dream is to find maybe a couple of folks who can pick up a full-time column with a magazine or other publication. That’d be awesome. I know you’re out there - let’s get the party started.
As you may know, I helped developing the forthcoming Microsoft Official Courseware 10962A class, “Advanced Windows PowerShell.” It’s a 3-day class that includes an overview of DSC, a full day of scripting and toolmaking, a Workflow overview, error handling and debugging, and more. It’s meant as a direct follow-on to the 5-day 10961 course. We’re scheduling a beta teach through a Microsoft training center in mid-August 2014. It’ll be taught by MCT Jason Yoder, who’s an excellent trainer (and who attended PowerShell Summit North America 2014 a few weeks ago, so you know he’s jiggy with PowerShell). There will likely be a fee to attend live or remote, as you’ll get the complete “A” rev of the course. If you think you might be interested, go to http://powershell.hosted.phplist.com/lists/?p=subscribe&id=7 and sign up. Once the full class info is online, we’ll e-mail you and let you know where to go find it - we won’t share your info with anyone else, including the training center. Do this quickly - the class will likely fill up.
I’ve been working on a new lab guide for my classes, and thought I’d share an early version. Note that this may become unavailable at any point; the final version will go on MoreLunches.com, as the lab guide corresponds largely with Learn Windows PowerShell in a Month of Lunches and Learn PowerShell Toolmaking in a Month of Lunches, as well as with several of the free ebooks here on PowerShell.org. Also note that there is no slide deck. I hate slides and don’t use them in class, so I haven’t produced any slides. I do use a few diagrams in class (I load them into an iPad app called AirSketch, which “broadcasts” to my computer’s web browser, allowing me to show those images on the screen, and to whiteboard on them as needed), and those diagrams are replicated in the lab guide for students’ convenience. This new guide is designed to be more standalone than the ones I’ve used in the past. Each lab includes background and syntax reminders, designed so that students don’t have to take notes while the instructor is demonstrating things. That way, everyone can focus on the demos. I basically review each lab myself before I start a unit, and then just teach and demo what’s covered in the lab. Students then get the lab itself as a reminder, and exercises to cement what they’re learning. In many of my classes, this guide is the only thing students have in front of them, and it works well with my teaching style. At 119 pages, it’s a pretty substantial guide - and I have about nine more units to write, plus an additional four I plan to develop in the future. You can download the guide in PDF form. Again, this link may go dead at some point when I’m done with the guide, and officially post it on MoreLunches.com. Right now, I’m very interested in what you think. It’s designed to present very concise summaries of what I teach, not completely replace me, but in some places it’s still pretty extensive.
There’s some great PowerShell content now online for your viewing pleasure. Jeffrey Snover and I had a blast doing “Windows PowerShell Unplugged,” and I reviewed some best PowerShell practices (and hopefully provided a little inspiration for your career) in “Windows PowerShell Best Patterns and Practices: Time to Get Serious.” And the #2 overall session of TechEd? “DSC: A Practical Overview,” including a surprise demo (and announcement) from Snover showing DSC running on Linux. Enjoy!
I’m going to be running a 3-day POWERCLASS April 2, 3, and 4 near Raleigh-Durham, NC! You can get full details on my company’s website, including pricing and class descriptions. Don’t leave near Raleigh-Durham? Well, it’s a fun place, and not that expensive to visit. More importantly, I’m not going to be doing a huge road-show and visiting a bunch of cities. Right now, my schedule is almost full through _September, _so this may well be the only public class I do in 2014. It might therefore be worth your while to take a short trip! The class will be VERY limited in size - just 16 students, max, and I’ll be happy with a bunch fewer. This is a hardcore class. We’re going to assume you’ve conquered the basics of Windows PowerShell and that you’re looking to implement best practices, start using PowerShell for real production tasks, and learn more about PowerShell performance and troubleshooting. It’s a “bring your own laptop” hands-on class, too, so you’ll get tons of hands-on time with an instructor who really cares about what you learn. This is all-new material, and you won’t find it anyplace else. It’s applicable to v2 through v4, although some things - we WILL be covering DSC, for example - only apply to specific versions (and you’ll learn which is which as we go). It’s the best PowerShell class I could come up with - I hope you’ll join me.
When I teach PowerShell, either at a private client or in a public class, I tend to use my own outlines. I’m comfortable with them, and they work really well. They formed the basis for the Microsoft 10961 and 55039 courses, although I had to make some changes to accommodate Microsoft standards and varying MCT delivery styles. But I’m often asked if there’s a “MOC-equivalent” outline that combines the entry-level 10961 with the scripting-focused 55039. Yup. First, do understand that I naturally teach at a very concise and accelerated pace. I don’t spend much time on slides; I tend to skip right to demos, and use those to explain what I’m explaining. If you follow a more common delivery style of around 5min per slide, plus taking your time on demos, my approach might not work well for you. I also tend to not tell a lot of ancillary stories, I tend to make students take break during lab time (rather than individually scheduling breaks), and I tend to be as concise as possible in my lectures. Also, when accelerating these courses together, you don’t do all of the labs. For labs with multiple components (find these 20 command), I’ll do about 1/3 of them. For the 55039 main-sequence labs, I’ll tell students to pick the “A,” “B,” or “C” version rather than doing all three; sometimes I’ll just have them do the “D” version (which gives them a pre-done starting point for each module, rather than making them build on their own work from a previous module). For Day 1, I’ll cover modules 1-5, and maybe module 6, from 10961. Day 2 will be modules 7, 9, 11, and 12 (covering 6 first, if I didn’t get it done on Day 1). That’s the “core” PowerShell stuff. It’s a fast delivery; it’s possible to spread those out over three days if you prefer, but I explicitly skip modules 6, 8, and 10 at this stage. When my students all have strong shell or scripting skills, 2 days often gets me through that. If they’re newer, I’ll go slower on modules 1-5, do more of the labs, and take 3 days to cover that 10961 material. The remainder of the course comes from 55039. That’ll be 2 or 3 days, depending on how long it took you to do the 10961 material. Regardless, I’ll cover modules 2-5. I’ll usually skip module 6, and try to end the day with module 7 on debugging. I’ll cover module 8, 9, and 10. That’s usually 2 days, so it’s the last thing I do if I took 3 days to cover the 10961 stuff. If I got through 10961 in 2 days, I’ll finish the 55039 material, covering modules 11, 13, and 16. If students insist on workflows, I’ll throw that module in there - I have mixed feelings and results when it comes to workflow, so it’s not part of my standard accelerated delivery. If you have extra time, my priority then goes to modules 15, 13, and 14, in that order. 14 gets you some GUI-building experience, so if the class is pushing for that I’ll include that module instead of workflow. If all that seems a little informal - well, it is. I’m very good at reading my students, and making sure folks are actually keeping up, so I don’t press too hard. This is a lot of conceptual and practical material to cover in a week. Price-wise, in the US, I see this kind of accelerated class going for around $3500, although a lot of training centers offer significant discounts. This accelerated outline is absolutely worth it: you’re literally taking someone from zero and teaching them how to build their own script modules and tools in PowerShell. It’s a lot to cover; not every class will be up to it. The labs in both courses are solid, and I’m especially happy with the ones in 55039 in terms of what they cover, and in how challenging they are. I’ll warn you that the 55039 labs don’t do a lot of hand-holding. Students are expected to learn the material and then execute the labs; the “answer keys” are outright sample solutions, not hints. But if you teach the material as provided, everything students need is in there - if they’re willing to work hard and retain what you’ve shared.
I’m in the midst of working on 10961C, the Windows Server 2012 R2 / Windows 8.1 / PowerShell 4.0 update of Microsoft’s 10961A/B course, “Automating Administration with Windows PowerShell.” I anticipate this being closed out by the end of November, 2013, so if you’ve taken or taught this course and have any feedback - even a typo - now’s the time to tell me. Drop a comment below, or e-mail me (if you have my address). Please, no Twitter replies on this one. The course will not be substantially changed from the B rev; because PowerShell v4 doesn’t change much, especially at the entry-level covered by 10961, there wasn’t much to alter. But I’m trying to sweep up as many lingering bugs and typos as possible. Kudos to MCT Jason Yoder for firing over a list of fixes!
Attention Microsoft training centers! Microsoft’s Courseware Marketplace now offers course 55039AC, “Windows PowerShell Scripting and Toolmaking.” Designed as a 5-day course, it’s a spiritual “Part 2” to Microsoft Official Curriculum course 10961. With 10961, the goal was to provide a founding in PowerShell basics, in a somewhat product-neutral way. That is, the course doesn’t cover Exchange, or SharePoint, or AD; it focuses on pure PowerShell. Unlike its predecessor, 10325, the 10961 course kind of “stops short” of actual scripting. It shows you how to build a parameterized script, but doesn’t dig into advanced functions, debugging, error handling, and the like. There was a feeling - which has been largely upheld through customer feedback - that a sizable audience needed to get the shell basics under their belt, and weren’t necessarily comfortable leaping into coding. 10325 kind of breezed through scripting at a somewhat high level, and didn’t have time to offer much in the way of practices and other guidance, and it didn’t really set you up for building reusable units of automation. That’s where 55039AC comes in. It is a scripting class, pure and simple, and it focuses on building reusable units of automation according to best practices and patterns. More time is devoted to design, structure, procedural error handling, and so on. There’s also deeper coverage of module building, including building custom formatting views, and there’s even an introduction to Workflow. Although designed for v3, the course is pretty version-agnostic, meaning it’s suitable for someone who wants to use PowerShell v2, v3, or beyond. And, because it’s a Courseware Marketplace offering, it’s compatible with Software Assurance (SA) training vouchers. Training centers are welcome to combine 10961 and 55039 to create an “accelerated” class that includes heavier scripting coverage than 10961 alone. I do that myself, actually, although it’s a pretty hardcore week. If you’re interested in doing that, contact me and I can provide some of the accelerated-delivery outlines that I use. 55039’s modules are all standalone - with a twist. Students are encouraged to use and evolve a single code project throughout several modules. However, if you’re not teaching all of the modules, or if a student falls behind, each lab comes with a complete “starting point” that keeps everyone on the same page. 55039 has already been beta-taught, and of course I welcome feedback if you’ve taught the course or taken it as a student. My company also offers licensing for this course outside the Courseware Marketplace, mainly geared to training centers who want an unlimited perpetual license to reproduce the course materials on their own. We know courseware costs are a significant concern, so we’re trying to offer something reasonable there. Both 10961 and 55039 (or at least a subset of 55039; we’re still working on exactly what) will be considered pre-requisites for the upcoming 3-day 10962 course, which will focus on advanced PowerShell techniques for us in production environments, including database connectivity, report generation, and so on.