As you probably know, the Install-WindowsFeature (used to be Add-WindowsFeature; that’s now an alias to Install-) can add Windows roles and features from PowerShell. If your server doesn’t have the installer source on the local disk, then the cmdlet will default to grabbing it from Windows Update - a pain for disconnected servers. Install-WindowsFeature does offer a means of using an alternate local source (like a DVD or file server location), but using it can be a bit hinky. The cmdlet help indicates that you should point to a Windows image (WIM) file. That’ll work, but you can’t just provide the path of the WIM. You also need to put a wim:/ prefix on the front of the path, and a suffix that tells the thing which edition of Windows you’re working with, so that it grabs the right bits. For example, wim:/d:/sources/install.wim:4. That “4” is the suffix for Datacenter Edition, telling the installer to look at index 4 within the WIM for the necessary feature.
I wanted to take a moment and wish everyone a very happy new year, and to do a sort of wrap-up of 2013 from PowerShell.org’s perspective. We started 2013 with a bang, including our first-ever PowerShell Summit North America, held on-campus at Microsoft in Redmond. We’ll be returning to the Seattle area in April 2014 for PowerShell Summit North America 2014, and are planning the first PowerShell Summit Europe 2014 in Amsterdam in September. For the N.A. show, we need about 50 more Summit attendees to break even, and can accommodate about 100 more than we’ve currently got registered. We ran a very successful Scripting Games that kicked off just as the Summit was ending. Thousands participated, tens of thousands of dollars in prizes were handed out, and most importantly the Games made the transition from being a much-loved child of the Microsoft Scripting Guys to being a community-owned event that can hopefully continue forever. We’ve got the first Winter Scripting Games in a loooong time starting in just a few days, in fact. In the wake of The Scripting Games, we ran a summer-long series of Great Debates, and your comments on those informed the first-ever Community Book of PowerShell Practices, now offered as a free ebook. PowerShell.org, Inc. closed its first fiscal year at the end of June 2013, and financially we lost just a bit of money. Don’t worry - that was always more or less the intent; we’re not running the corporation to make a buck, but rather to more-or-less break even. At the moment, we have $29,988.25 in our checking account, most of which is earmarked for Summit 2014 expenses. We’re now providing hosting services for about 17 local and regional user groups, giving them a spot to post upcoming meeting dates, post-meeting file attachments, and other details. We’re hoping this helps raise awareness of the efforts they’re all making to have a strong local PowerShell support system in place. 2013 also saw the PowerScripting Podcast become a welcome part of PowerShell.org. Host Jon Walz also got his first MVP Award, a long-awaited and well-deserved honor that he now shares with co-host Hal Rottenberg. Everyone appreciates the hard work they do, and we at PowerShell.org wanted to make sure they had the resources to keep doing it (equipment ain’t free), so we offered to help out when they needed, and they graciously accepted. We’re delighted to be working with them. PowerShell.org played an important role in developing Microsoft’s official entry-level PowerShell training, course 10961, by giving the authors (e.g., me) a place to survey folks about topic, level of coverage, and more, and to solicit feedback on the “A” and “B” revs while updating the course for PowerShell v4. This site (and all of you) also played an important role in selecting topics for the advanced-level training, course 10962, which will be developed in 2014. Finally, you all helped provide feedback for Microsoft Courseware Marketplace course 55039, which covers PowerShell scripting and toolmaking. When you see a survey posted here, jump in - it makes a very real difference in some very important projects! 2013 was also the year we Moved to Azure, spinning up an Azure-hosted CentOS VM that’s now running the site. It’s gotten faster, is a bit easier to maintain, and is a heck of a lot more highly available thanks to Microsoft’s cloud hosting. I’m extremely proud to have had so many folks jump in and help out this year. Dave Wyatt, Matt Penny, Matt Johnson, Mike Shepard, and Nicholas Getchell have all taken on curator roles for the free ebooks we offer on PowerShell.org. They’re doing a wonderful job in making sure those titles stay updated - so much so, that we’re now just linking to the books’ GitHub repository, where you can download the DOC files directly. Dave Wyatt has also been posting some incredibly detailed and informative blog posts that I hope you’re reading - I really appreciate his contributions here. I also want to thank Matt Tilford, Chris Hunt, and Mark Keisling, who have taken on editorial duties for the TechLetter newsletter. Our aim is to put out a solid, informative, technically deep monthly offering and these guys are absolutely on the job. I hope you’re subscribed, because if you aren’t, you’re missing out. Finally, MVP Steven Murawski has made PowerShell.org his home for Desired State Configuration (DSC) blogs and code, and he’s been prolific. His employer, StackExchange, has been an early adopter of the DSC technology, and Steven’s been sharing pretty much everything he’s learned. We’ve had some transitions in 2013. Board member and co-founder Kirk Munro has had to step away from day-to-day duties with PowerShell.org, although he remains a member of the board. Board member Jason Helmick has stepped into a second-in-command position, and is more or less running the North America Summit from an operational perspective. Jason earned his first MVP Award this year, giving us an all-MVP Board that also includes myself, Jeffery Hicks, and Richard Siddaway. I’m extremely proud of everything we’ve accomplished. I’m delighted that so many folks are jumping into the forums and offering answers to questions - it’s a massive relief on my own workload, and there are some damn smart folks offering their help to the community for free. In fact, we plan to recognize some of them in our first-ever PowerShell Heroes award, scheduled for January 2014. We’re also going to make good on a promise I made when we started this site: our above-and-beyond contributors are going to become part-owners of this community with an award of stock in PowerShell.org, Inc. That’ll give them some concrete control over the community they’re helping to build. Look for that mid-2014, when we near the end of our fiscal year. For 2014, I’d like to thank our returning sponsors, SAPIEN Technologies and Interface Technical Training. These folks give a lot, financially, to help make this site work. Please show them your appreciation in every way you can. In 2014, my company, Concentrated Tech, is also coming aboard as a sponsor, and I’ll be offering my first-ever public PowerShell training. I think 2014 should be a great year, both for PowerShell.org and for the broader PowerShell community that we’re trying to serve. If you’re new here, or you’ve just been lurking, please jump in and help. Write an article about something you learned, answer a question in the forums, or volunteer to help out. We’re all in this together, and the stronger a community we all make _together, _the more we’ll be able to support each other when needs arise. I look forward to serving you in 2014! Don Jones President and CEO
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.
We’ve had an outpouring of support for the upcoming games, with more volunteers than we know what to do with! At this point, we have our judging panel completely full; we’re operating with a fairly small group of celebrity judges this time around. Games Master Richard Siddaway will introduce our judges in a few days. We’ve also filled our roster of Coaches, and Head Coach Mike Robbins will provide that lineup soon also. If you’ve volunteered but not heard from Richard or Mike, then you should definitely start recruiting a team for when registration and team formation opens in a couple of weeks!
$computers = Get-ADComputer -filter * -searchBase "ou=test,dc=company,dc=pri" foreach ($computer in $computers) { write-host "computer $computer" $result = Do-Something -computername $computer Write-Host "$($result.property) and $($result.value)" } Would you ever consider that acceptable? Some folks might well say, “sure! if I was just testing this, throwing in those Write-Hosts is no big deal. Heck, even if I was the only one who was going to use this, Write-Host isn’t bad.” And the point I’m going to make doesn’t just apply to Write-Host. It applies to anytime when you’re doing something that you know breaks “best practices,” but you justify it because it’s “just for you” or because “it’s just for testing.” To wit: if you need your script to output some status or tracking information, as in the above, use Write-Verbose. Yes, Write-Verbose requires a script or function to have this at the top:
Windows Azure has advised us of scheduled downtime on Friday, December 6, from approximately 15:00 hours (US Pacific) until approximately midnight Pacific time.
Released in our new Git repo: _The Community Book of PowerShell Practices, _an ongoing book started from this past Summer’s “Great Debates” blog post series. Grab it from https://github.com/PowerShellOrg/ebooks/blob/master/Practices/2013Sep_Practices/2013Sep_Practices.doc and enjoy!
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!
A quick note and an apology: I’ve had to modify the site configuration to require users to be registered and logged in before they can comment. We’ve been taking a ridiculous amount of comment spam, and it’s consuming more and more time to weed through it. You can register using any major social media account, so you don’t have to remember yet another username and password with us, so hopefully that’ll mitigate the inconvenience. Have a great week!
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.