Chapter 18 Sessions: remote control, with less work

You probably wouldn’t guess this from the chapter’s title, but this chapter is about Sessions. It was also partially a review of the earlier chapter in remoting, although this chapter was a bit more of a deep-dive on Sessions.

Introduced in this chapter was the concept of implicit remoting. I know, it even sounds cool right?! This technique allows you to access to the administrative cmdlets  which might be present on a server in your enviroment. But it allows you to run those cmdlets locally, with no administrative module/plugin installation required. This is a super cool technique, and although I don’t really have a direct use for it at this moment, I am definitely putting that one in the arsenal cause I know I will use it!

Chapter 19 From command to script to function

Being walked through the steps and thought process behind taking a command, turning it into a  script, and then to a function, is invaluable. Having one of the top powershell experts to walk you through makes it even more so.

That is pretty much exactly what this chapter contained. We have a command we want to be more reusable. We have to turn that command into a fuction and then troubleshoot the function in order for it to provide the results and output that we want. Worth the price of admission as they say!

Chapter 20 Adding loops and logic

This is a very important chapter. Anyone who writes any amount of powershell scripts will tell you that knowing how to correctly add and use logic statements in scripts is up there on the priority list.

Having said that, this chapter walks though most of the logic and loop statements an administrator would use, excluding the Do loop. This is accomplished with both explanations and examples for all.

Personally I use the IF and the ForEach, a lot more than I would use, For  or Switch. Since I don’t use the latter often I always need to look up syntax, and then just end up doing it with an If or a foreach. Providing a lesson on those lesser used constructs(atleast for me) was a great refresher, and more encouragement to start becoming more familiar with them. The labs also certainly help with that.

Chapter 21 Creating your own “cmdlets” and module

First and foremost this chapter blew my mind. Secondly this could be the chapter that has contained the most information. At the very least most of the information in the chapter was new to me.

When the concept of having a “worker” function and public function was introduced, I literally said alound “Oooh, that is super neat!” For the record, I almost never say anything like that, for all kind of reasons I won’t go into here 🙂

This is obviously and advanced topic, but it is approached in such a natural way, that even if you may have to come back and reference the specifics later on, you understand that concepts up front; which is really important.

Chapter 22 Trapping and handling errors

This chapter addresses something that every script should have….Error Handling.

This chapter also addresses why it is that I never really use the Trap construct….Its confusing.

Even though the trap construct is confusing, I thought that it was pretty well explained in the chapter. Although I still don’t see myself using it very much in  the future.

The Try and Catch constructs were also discussed. These are constructs I have used more often in my own scripts. They, however were only talked about in the general sense.

Being that I still don’t use Try and Catch to catch specific errors, I would have also appreciated a quick walkthrough on catching specific errors. It was mentioned to use the help about_try_catch for more information on specific errors, but I personally think it could have been done very well in the book without taking up much time.

Chapter 23 Debugging Techniques

Fixing your shit when it breaks is important, and this chapter definitely teaches you how to clean up your own scripting mess.

I was very curious going into this chapter as I always want to know more, and better ways that I can improve my scripting, of which debugging is a big part.

I was pretty excited when one of the ways the chapter aids in the debugging is to place Write-Debug commands to test the logic statements. This was exciting because I do almost the same thing! I don’t use Write-Debug, I have used write-host in the past to do the same thing, but having seen write-debug in action, it is probably the better call.

The chapter also focuses on breakpoint, which I have not really used previously. A breakpoint is essentially a spot in your script where the execution of your script pauses in order for you to test variables or anything else that would be in the script’s scope. Very Useful Indeed! I know I will be referencing this chapter in the Future for breakpoint examples and explanations!!


0 Comments

Leave a Reply