Chapter 2 Running Commands
This was a fun chapter for me, and was more or less a review of info I already have a pretty good grip on. My favorite part is when Don explains how in his classes he makes his students repeat parameter syntax aloud… Hilarious!
There was a nice review of PSDrives for me, which was nice because it is something that I don’t use often. This brought back information that I don’t often use or never even knew regarding PSDrives and hopefully further cementing my understanding of it.
The lab was pretty straightforward with basic commands most of us know just from cmd… like dir, copy etc. However I tried to do the lab with just using the actual posh cmdlets, no aliases, which means get-childitem, or copy-item. This was also slightly tough for me only because I am constantly using get-help normally in powershell, but Get-Help hasn’t been introduced yet in Chapter 2 so I attempted to stay away from it, which I believe is intended. The reason this was tough is although I knew which cmdlet I wanted, I couldn’t remember the parameter I wanted, or even the acceptable input values for that parameter.
Fortunately for me though powershell is smarter than I gave it credit for and after hitting return with just the cmdlet entered, I was prompted for the information it needed to complete the task. The other nice thing is when you guess terribly wrong for what a parameter value should be, powershell will probably give you a little hint in its error. For me this was New-Item and entering folder for the item type, but posh gently nudged me toward the correct Directory input for the item type.
Chapter 3 Using the Help System
Sometimes you learn something awesome, that you should have known, but had no way of knowing until someone gives you that information. This chapter was a lot like that for me. Before this chapter, when using get-help, I never knew what the square brackets meant around the parameters or how square brackets around different items mean different things inside of get-help.
I also have always used get-command previously when I was trying to figure out the right cmdlet I wanted to use, I didn’t realize, nor have I ever tried using get-help with wildcards that would produce mutiple cmdlet returns with short descriptions of each
Ugh, even though I have been using powershell for a while now and feel like I am gotten pretty decent and respectable at it…this book just makes me feel like a noob 🙁
Chapter 4 The Pipeline
This was more of a review chapter to me, since I use the pipe-line religiously all the time. Although this chapter had me use Compare-Object probably more than I ever had before. Compare-Object although useful in some circumstances, in general just always feels a bit clunky whenever I use it…don’t know why.
There was one thing in this chapter though I would have liked to seen differently though. It goes from a
Which is obviously explained what would happen if you ran that and why you should NOT run that command to a
get-process -name notepad|stop-process
I personally would have liked to have seen just a “get-process -name notepad” between those two.
The reason for this is because it has always been important to me that powershell is returning exactly the right object or objects I want, before I affect them in some way. Yes -confirm and -whatif were explained shortly after, but again, from my personal experience, I think “pulling” or having powershell return the object you want is an important middle step. Also it’s notepad and pretty harmless, but I still prefer doing just a Get and confirm the correct object is there before I do something to that object.