Automating Administration with Windows PowerShell 2.0
Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 2 Design of the Course The modules of this course have been arranged to guide students through the skill development they need to successfully learn Windows PowerShell. Its important that you teach these modules in the order presented. This is a course about how to use Windows PowerShell. It is not a course about how to administer Windows Server 2008 R2, although that version of Windows is used for the examples in the course, and for the labs in which students will practice their Windows PowerShell skills. The single biggest hurdle for students to get past is their experience of the typical Windows PowerShell enthusiast. Rather than blogging about how to use what is in Windows PowerShell, enthusiasts concern themselves with edge casestasks that arent accomplished easily in Windows PowerShell. Many new students come into a PowerShell class intimidated and have an incorrect impression that Windows PowerShell is overly complex or that using it requires strong programming skills. When Windows PowerShell cant do something using cmdlets, many administrators avoid using Windows PowerShell to accomplish that task. It might be possible for them to use a .NET Framework class, but unless they already have a software development background, most do not have the time or inclination to learn how. Instructors do their students a disservice when they try to cram every bit of Windows PowerShell intelligence into the class time. While tips and gotchas are tremendously important, you cannot teach everything in five days. Human beings can learn two or three new things an hour; bombarding them with disconnected, unrelated tips, exceptions, and extras dilutes the main instructional goals of the course. Students distracted from the course goals tend to perceive Windows PowerShell as an inconsistent, chaotic set of disconnected tasks. Those students are disinclined to regard Windows PowerShell as important, and they tend to spend less independent time with it when they go home. So although cramming knowledge into a class may make the instructor look well- informed, it does not help the student learn anything of value. Because we are trying to teach new patterns of thinking, everything we do must support that goal. If we can help students gain confidence in their own ability to be successful with Windows PowerShell, Windows PowerShell itself will ultimately be more successful. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 3 Required Materials to Teach This Course To teach this course, you need the following materials: Course Handbook. Course Companion CD. Microsoft PowerPoint Files. Microsoft Virtual Server Classroom Setup Guide. Course Virtual Machines.
Important: We recommended that you use PowerPoint 2003 or later to display the slides for this course. If you use PowerPoint Viewer or an earlier version of PowerPoint, all the features of the slides might not be displayed correctly.
Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 4 Prerequisite Knowledge to Teach This Course To present this course, you must have: Thorough knowledge of Windows PowerShell version 2. Thorough knowledge of Windows Server 2008 R2, IIS, and Active Directory. Have taken and passed the relevant Microsoft Certifications.
Preparation Tasks Complete the following tasks to prepare for this course. Technical Preparation Activities You should complete the following technical preparation activities: Read the additional readings and references included on the Course Companion CD. Practice using the Microsoft products and tools associated with this product. Practice setting up the classroom by following the instructions in Microsoft Hyper-V Classroom Setup Guide, 10325A_hvs.pdf. Practice carrying out the demonstrations. and refer to the 10325A Instructor Delivery Tips.pdf for guidance on how best this can be done. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 5 Instructional Preparation Activities You should complete the following instructional preparation activities: Read the Curriculum Design Guide for the broader context of the curriculum of which this course is a part. The Curriculum Design Guide is located on the MCT Member Site (https://mcp.microsoft.com/mct/resources /ResourceCenter.mspx). Read the About This Course at the beginning of the Course handbook for the product. Walk through the Introduction slide deck for the product. Walk through each module presentation slide deck and read the corresponding Instructor Notes (located in the Notes view of the presentation slide deck) for the module. Note that additional hidden slides are used frequently to accommodate the amount of Instructor Notes information for a given topic. Familiarize yourself with the Course Handbook and the Course Companion CD. Make note of when to direct students attention to the Course Companion CD for further learning. You can find more information about course components in the Introduction slide deck. Practice presenting each module. Identify the key points and must-know information for each topic. Perform each demonstration and hands-on lab. Anticipate the questions that students might have. However, refrain from addressing questions out of order; be prepared to inform students when the course will answer their question. Identify examples, analogies, impromptu demonstrations, and additional delivery tips that help to clarify module content and provide a more meaningful learning experience for your specific audience. Note any problems that you might encounter during a demonstration or a lab exercise, and determine a course of action for how you will resolve the problems in the classroom. To access the lab answer keys, click the link provided at the bottom of each lab exercise page on the Course Companion CD or refer to the appendix in the Course Handbook. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 6 Work through the Module Review and Takeaways section at the end of each module and determine how you will use this section to reinforce student learning and promote knowledge transfer to on-the-job performance. Customize and enhance the instructor notes. Consult the MCT newsgroup for additional tips and strategiesposted by your fellow MCTsfor teaching Windows PowerShell. Review the updated information about the Microsoft Certification Program on the Microsoft Learning Certifications Web site. Please also refer to the 10325A Instructor Delivery Tips.pdf which provides general guidance on how the demonstration and the course itself may be run. This document is available as part of the trainer download package. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 7 Instructor Computer Setup Set up the instructor computer by following the setup instructions in the Microsoft Hyper-V Classroom Setup Guide 10325A_hvs.pdf. document. This document provides hardware requirements for the instructor computer in addition to detailed setup instructions. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 8 Course Timing The following schedule is an estimate of the course timing. Your timing might vary. Some students might not finish every lab. Use your judgment to set a reasonable time to move on to the next module. Day 1 Start End Module 9:00 10:00 Introduction, Module 0 10:00 12:00 Module 1: Fundamentals for Using Windows PowerShell v2 12:00 1:00 Lunch 1:00 2:30 Module 1: Fundamentals for Using Windows PowerShell v2 (continued) 2:30 5:00 Module 2: Understanding and Using the Formatting System
Day 2 Start End Module 9:00 9:30 Day 1 review 9:30 12:30 Module 3: Core Windows PowerShell Cmdlets 12:30 1:30 Lunch 1:30 5:00 Module 4: Windows Management Instrumentation
Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 9 Day 3 Start End Module 9:00 9:30 Day 2 review 9:30 12:00 Module 5: Automating Active Directory Administration 12:00 1:00 Lunch 1:00 3:00 Module 6: Windows PowerShell Scripts 3:00 5:00 Module 7: Background Jobs and Remote Administration
Day 4 Start End Module 9:00 9:30 Day 3 review 9:30 11:30 Module 8: Advanced Windows PowerShell Tips and Tricks 12:00 1:00 Lunch 1:00 5:00 Module 9: Automating Windows Server 2008 R2 Administration
Day 5 Start End Module 9:00 9:30 Day 4 review (and remainder of Module 9 that was not completed on previous day). 9:30 11:00 Module 10: Reviewing and Reusing Windows PowerShell Scripts 11:00 12:00 Lunch 12:00 5:00 Module 11: Writing Your Own Windows PowerShell Scripts
Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 10 Module Delivery Notes Its often helpful for an instructor to understand what a course designer or author was thinking, what the goals were for a particular module, and so forth. Thats what this section is for: To help you, the instructor, understand the underlying goals and ideas behind each module and to prepare for some of the areas where many students encounter obstacles. Youre also welcome to contact this courses designer and authors: Visit http://concentratedtech.com and use the Contact Us link to send a message. Module 0: Introduction Conduct your introduction as you normally would. Be aware that you need to make some delivery decisions based upon your students experience and expectations. Some key information to determine: How much programming or scripting experience do your students have? Have they used Microsoft Visual Basic Scripting Edition (VBScript) or other scripting languages? If not, you may want to consider skipping Module 11, or delivering it as an overview and skipping its labs. See the delivery notes for that module for more specifics. How experienced are your students with Windows Management Instrumentation (WMI)? If they have a great deal of WMI experience, you may consider covering Lesson 3 and Lab B from Module 4. That modules delivery notes explain more about this option. How much prior command-line experience do your students have? Have they used Cmd.exe? Would they recognize a command such as Dir | More and be able to explain what it did? Have they used a Unix or Linux command-line shell? Students with absolutely no command-line experience will have a more difficult time picking up this courses basic concepts, so be prepared to guide them and perhaps spend more time than suggested on the first three modules. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 11 Module 1: Fundamentals for Using Windows PowerShell v2 This is a straightforward introductory module intended to get students using the shell in a familiar fashion. There are a few very important instructional tips: First, do not use the words scripting, programming, or development. While you may very well have students who are not put off by those words, we find that many less- experienced administrators become anxious when they hear those words. They are often concerned that they are going to have to learn scripting, and they are afraid that they will not be able to do so, which makes the entire learning process for the entire course much harder for them. Just avoid using those words. Second, many administrators have heard the terms object and property before, usually in a software development context. Those words create the same kind of anxiety as scripting. To help reduce that anxiety, do not engage in a detailed ad-hoc explanation of what objects are, what properties are, what methods are, and so on. Placing that kind of emphasis on objects distorts their importance in students minds. In fact, to deemphasize the impact of the words, we alternate between object/element and property/attribute so that the concept, rather than the terms, has a chance to settle in students minds. The final major goal for this module is to get students using the shell. Have them run familiar commands, like Dir, and Ping, and Ipconfig. Help them feel that this isnt something terribly new and scary but just a different environment for the same things theyve been doing for a long time. Module 2: Understanding and Using the Formatting System This module is designed to get students piping things from one cmdlet to another, without really realizing that theyre doing it. We dont explain piping here; we just start doing it. Students who have run something like Dir | More will recognize the pipe and understand what is happening. This module falls back to the attribute/element terms, rather than property/object. Again, our goal is to de-emphasize what we have seen being an anxiety-inducing term. Rather than getting students focused on understanding objects, we gloss over it, saying that stuff gets put into the pipeline, and that stuff has attributes like name and ID. You can select which attributes you want to see on the screen and so forth. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 12 Module 3: Core Windows PowerShell Cmdlets This is where we commit to the object/property terminologyhaving allayed any related anxiety, we hope. This is also where we formally introduce the concept of piping. We have found that explaining it after students have already seen it in action is very effective. Because theyve already seen it, theyre not sitting through the explanation wondering what piping looks like. Were really just explaining the mechanics of something they already know. Pipeline parameter binding, at the end of this module, is where most students will have their first difficulties in this course. There is, unfortunately, no real way to make this easier for them. One way to think of it is to consider Unix administration: Unix has a very high skill level at entry; most Unix administrators are very skilled because it is impossible to administer Unix otherwise. Windows is a lot easier to administer, at least to a certain point, and so administrators often do very well without having to face extremely complex concepts. Windows PowerShell, unfortunately, imposes a price for admission, and the complexity of pipeline parameter binding is a good representation of that price. We suggest that you reserve ample time not only for the labs but also to review the lab answers. Dont let students struggle too long on their own in the labs: Theyll become frustrated and feel defeated. Rescue them when possible by perhaps reviewing the first exercise, letting them work for a bit more, review the second exercise, and so on. Module 4: Windows Management Instrumentation We had originally hoped to not include WMI in the course. When teaching beginning Windows PowerShell, we have a motto: If you cant do it with a cmdlet, do it in the GUI until a cmdlet comes along. WMI is clearly the exception: It offers too much access into local and remote management information. Unfortunately, its also ugly. Its a whole new set of syntax and concepts. We strongly urge the use of a visual WMI explorer to help students visualize the WMI namespace. Spend time covering the concepts and examples from the course text, even though not every single one is introduced on a slide. In the labs, help students avoid frustration by perhaps completing and then reviewing individual exercises rather than setting them loose on the entire lab at once. If you have an especially advanced or experience audience, you can teach the Lesson 3 and Lab B from the students Companion Content. The material is interesting and useful, but for absolute beginners it tends to be far too much information and far too many new concepts at once. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 13 Module 5: Automating Active Directory Administration This should be a fun and effective module for most students. It gets them into hands-on, practical, real-world administrative tasks. We also emphasize the use of pipeline parameter binding in practical examples. With some classes, you may choose to swap Modules 4 and 5 in your delivery. Doing so gets students into practical tasks more quickly, and it quickly reemphasizes the pipeline parameter binding they learned at the end of Module 3. A concern, however, is in putting Module 4 too near the end of the day when students are already becoming tired. Module 4s placement is, in fact, driven entirely by that concern. If you find yourself short on time, Lesson 3 and Module 5 Lab B can be skipped. You can return to them later, if time permits. Module 6: Windows PowerShell Scripts Finally, we feel comfortable using the scripting word with the students. Our approach to scripting at this point is extremely simplistic: Scripts are basically batch files, and like batch files they can even be parameterized. At this stage of their learning, we simply want students to use scripts as a way of repeatedly using long, hard-to-type commands more easily. This should be a level of scripting that any administrator can quickly become comfortable with. Module 7: Background Jobs and Remote Administration This is another module that can be a lot of fun. Remoting is certainly a powerful, compelling capability that can drastically change the way students work in their production environments. Background jobs are an independent, yet related concept that can have great utility in production environments. Start helping students focus on troubleshooting skills: If remoting is not working, check to see whether it is enabled on the target computer, for example. Be cautious during the demonstrations: The first demonstration directs you to enable remoting on LON-SVR1 and LON-SVR2. If you skip that step, youll get error messages in the demo. You may actually want to let that happen, so you can help students have a eureka moment as you realize you forgot to enable remoting and then manually do so on those two computers. People learn through mistakes, and having you make that mistake will make it easier for them to deal with that all- too-likely scenario when they encounter it on their own. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 14 Module 8: Advanced Windows PowerShell Tips and Tricks This is a kind of miscellaneous module with useful, easy-to-learn techniques. The idea is to give students a kind of mental break, while showing them some useful new tricks. This module introduces functions without really doing so. At this stage, functions are simply a different kind of commandsimilar to a cmdlet and used in much the same way, but programmed differently. Students at this point are consumers of functionsthat is, they might be given a function by a colleague, or they might find a function on the Internet. They arent programming functions yet, but they can use them. Module 9: Automating Windows Server 2008 R2 Administration This module has one goal and one goal only: To get students to start working with Windows PowerShell independently. We deliberately do not introduce specific cmdlets, syntax, or examples in the lecture; students should find that information on their own, using the skills they should have learned by now: Help, Get- Command, Import-Module, and Get-Member. This is one module where you should really encourage students not to cheat by looking directly at the Lab Answer Key. The main skill that this course seeks to teach is looking up help and examples on your own. All of the information students need to complete the labsespecially examplesare contained in the help files. We want students to use those help files. Why? We dont have time in this course to teach Microsoft Exchange Server, Microsoft SharePoint Server, Microsoft SQL Server, and all of the other products that provide Windows PowerShell cmdlets. However, if we can teach students how to teach themselves, they can become successful and productive with any Windows PowerShellbased product! A delivery note: If you are working with an advanced group of students and they do not have time to finish all of the labs in this module, do not carry that work over into the next morning. You can allow students to return to those labs if they have time on the last afternoon. However, if you are working with a more entry-level group of students and do not plan to deliver Module 11, allow them to complete this modules labs on the last morning, if necessary. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 15 Module 10: Reviewing and Reusing Windows PowerShell Scripts One of the core skills administrators need is the ability to take a script that someone else has written, review that script to understand what it does, and identify areas of that script that may need to be modified to run in their environment. Those skills are exactly what this module tries to build. Do not try to explain what each and every line of the script does. That is not the point. There are two main points: What does the script do? To find out, look for commands. Commands are what take actions. Scripting constructs control the flow of those commands, but they do not take action themselves. So focus on the things that take action to determine what does this do? What needs to be changed? What kinds of informationWeb sites, domain names, user names, passwords, file paths, and so onare hardcoded? These will need to be changed so that the script can run properly in someone elses environment.
Thats it. This module is not an excuse to start teaching scripting or programming. Were trying to enable administrators to more easily reuse and repurpose scripts that they acquired from elsewhere. If you start explaining PROCESS script blocks, ForEach loops, and variable data types, you are going too deep at this stage. For example, you dont explain why PowerShell functions have to be defined before they can be used; you simply explain that, in fact, functions have to be at the top of the script. Period. Just because. The best recommendation we can offer is to follow the narrative in the course book. Stick with it. It highlights the important things and keeps the discussion at the right level. This is a short module, and there are really two main ways to deliver it: For the two long demos, direct students to read the course text and review the example script files on their own. Then discuss their findings as a group. Do the two long demos as a traditional demo. You, the instructor, can use (or adapt) the text from the courseware as your demo narrative. It may feel as if youre reading a book aloud, and normally we wouldnt recommend that, but this is a special case. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 16 If you are teaching a class consisting primarily of entry-level students with no scripting or programming background and who are entirely new to Windows PowerShell, you might want to end the class after this module. You may choose to spend a bit of extra time on this module and have students do a lightweight lab: Ask them to go through the remaining script files and identify major commands, as well as items of hard-coded information that needs to be changed. Perhaps assign a different script to each pair of students, and then ask each pair to present their findings to the class. NOTE: There is no lab in this module, rather there are two demonstrations based around the same set of scripts. There is no "intended" answer or working script provided and the purpose is really just passive exploration. Providing answers on this one goes against the whole objective of the module. Too many students will just jump straight to the answers and never get the experience we wanted them to have. Module 11: Writing Your Own Windows PowerShell Scripts This module is entirely about programming. If you have an entry-level group of students with no programming background and who are seeing Windows PowerShell for the first time, this module will probably be too much for them. You may still choose to review this module with them, and perhaps skip the labs, so that they are exposed to these concepts. However, you should use discretion: Many administrators will never use Windows PowerShell at this level, and these concepts can be overwhelming. On the other hand, if you have a more advanced group of students, this module can be a very effective introduction to both basic and advanced scripting concepts. An intermediate group of students may also appreciate seeing Module 11. You should make your decision whether or not to deliver this module on the first day so that students have an accurate expectation of what you will be teaching. A word on variables and scope: Our general preference is to teach the -Variable cmdlets as a means of manipulating scope, such as changing a variable in another scope. Our reason for doing so is that its easier for students to imagine the current scope as zero, their parent as 1, and so forth, and the -Variable cmdlets can accept that number to more precisely designate the scope to be modified. We always felt compelled to show the less-formal $global:var and $script:var syntax, however, because these are more prevalent in the wild, and we want students to be aware of them. Trainer Preparation Guide for Course 10325A: Automating Administration with Windows PowerShell 2.0 17 A word on error handling: We show both the Trap and TryCatchFinally constructs; we very much prefer the latter because its easier, more granular, and it doesnt introduce an additional scope that has to be dealt with. TryCatch also encourages the application of error handling to the precise place at which you anticipate an error, and we like the planning that encourages. We still see Trap used for top-level error handling in highly complex scripts. Dissuade students from globally setting $ErrorActionPreference="SilentlyContinue" because its unfortunately becoming a common practice and has the effect of suppressing all error, which makes debugging a much more difficult task. To suppress anticipated errors from a single cmdlet, add "ErrorAction SilentlyContinue" to that one cmdlet. Appendix This module is not intended for in-class delivery, but with an especially advanced audience you may wish to cover it. Its main purpose is to introduce students to some of the more advanced Windows PowerShell capabilities, especially scripting- related features. It does not include labs, but it does include a detailed example of each major feature to give students a starting point for their own exploration.