If you didn’t catch it, I posted about getting more in depth with PowerShell a couple weeks ago. I am using the excellent book by Don Jones and Jeffrey Hicks “Learning PowerShell 3.0 In A Month Of Lunches”
Below is a summary of the first 5 days of lunches with the book
Day 1 – Get PowerShell installed and configured -
I actually already had this in place since I was already doing a few things with Windows Azure PowerShell. I am also running Windows 8.1 on the machine I am using at home so that machine uses PowerShell 4.0 vs PowerShell 3.0 which the book is based on. The same goes for the Windows Azure based PowerShell lab I built. I am using Windows Server 2012 R2 VM’s which also use PowerShell 4.0 by default.
I learned to check the version of PowerShell using the $PSVersionTable variable.
I also already had PowerShell ISE (Integrated Scripting Environment) installed on my Windows 8.1 home machine because of other work. Also, PowerShell ISE was installed by default on my Windows Server 2012 R2 VM’s.
Day 2 – Choose the shell to use
For the little bit of PowerShell I have done, it has mostly been through the basic PowerShell console. I discovered ISE much later and by the time I did, I realized I was doing mostly basic commands. For quick commands I prefer to use the PowerShell Console. If I am going to write and debug a script, I prefer ISE. Keep in mind though that on a Windows Server Core install (with no GUI), your only option is the basic PowerShell console. PowerShell ISE cannot be installed to a GUI-less install of Windows Server.
I will say this for the ISE console, I like the color separation it provides even when typing commands for immediate execution. The visual cues really help me with syntax. This is just one of the many features of IntelliSense.
I also learned there are some other 3rd party PowerShell editors. For now I am going to stick with ISE, but I plan on checking out the others as time goes by.
Day 3 – Finding and Getting Help
One of the great things about PowerShell is the integrated help environment. It is entirely possible to teach yourself how to use PowerShell by using only the integrated help. The level of documentation including syntax and samples in remarkable. When I was in my early 20’s, this is probably exactly what I would have done. Now that I can see 50 peaking around the corner, I need a little more structure just to keep me on track. Thus the reason I am using the #MonthOfLunches book.
This entire day/chapter is dedicated to exploring the help system. I would argue that this chapter makes for an extended lunch simply because of the amount of documentation there is to explore. It is easy to lose yourself in all of the commands.
I already new how to update the Help system using Update-Help so I updated all of my systems very quickly.
I was not aware of the recommendation to update help once a month or so. It never occurred to me that Microsoft might update PowerShell help that often, but in retrospect, the emphasis on PowerShell administration we see in every aspect of Windows makes sense. I know I won’t remember to update help manually, so I used ISE to save a script called UPDATEPSHELP.PS1 that contains only the Update-Help command. I then used Task Scheduler to set that script to run once a week early on Wednesday mornings. This way, if anything gets updated as a result of a patch-Tuesday, I get back in synch no more than 24 hours later.
I learned about Parameter Sets, what is optional vs mandatory as well as what can be abbreviated. For now, I will be typing (or tabbing) everything out just so I can make things stick in my head. It will be much easier for me to figure out what I have done if I have it as well documented as possible which means spelling everything out and not dropping optional features unless absolutely necessary.
I learned about a whole set of aliases that speed up writing commands and scripts – Get-Alias
Tomorrow, I will post a summary of day 4 alone. This chapter dives into running commands and I feel it deserves it’s own summary since this is the heart of what we are trying to get to.