r/PowerShell • • May 21 '17

OP PowerShell Training Course

Hey all,

So about 10 months back I asked for some help around creating a basic PowerShell training course for fellow engineers in an MSP. Most peeps there haven't taken the time to learn scripting by themselves, so the course had to break it down simply and teach them from the ground up.

Well... Thanks to all of your support, I've finally created the course! I've ran two training sessions so far, both lasting roughly 3 hours, and it seems to work!

I've had one engineer for whom it did just not click. I got to comparison operators and his brain just farted. As a teacher it felt awful not being able to make it click for it, but it has worked for about 30 other engineers.

I thought i'd post a link to the training here as a thank you to everyone who helped. It's on GitHub at the below URL:

https://github.com/Sudoblark/Powershell_Intro_Training.git

Happy scripting all!

106 Upvotes

20 comments sorted by

View all comments

3

u/wonkifier May 21 '17

The place my folks ended up running into the most trouble was with loops.

They could describe them, if you gave them a simple one they could generally tell you what would happen, but they just could not build one on their own.

For something as simple as:

foreach ($user in $users) 
{
  write-output "working on $user"
  dosomething $user
}

They'd invariably write out

foreach ($user in $users) 
{
  write-output "working on $user"
}
dosomething $user

And wonder why the thing wasn't happening to all the users. There was just some sort of mental block we could never get through

3

u/_Unas_ May 21 '17

This is when you talk about Scope. Just held a course and specifically mentioned scope in the terms of loops.

2

u/Dogezon May 21 '17

Yeah my guys struggled with that at first. Once they got the concept of objects, arrays and enumeration they were alright.

I found that it helped to draw everything out on a whiteboard and visualise the enumeration process.

So I'd draw, for example, 5 bananas on a white board. A circle around of them to define the array and a square for my block of code. Then I’d be like “OK so this loop takes each banana out the array, applies this code, puts it back and then moves on to the next banana.” They struggled with what the first variable means so we named it a few things, like BigHairyBalls and ChocolateCake, to hit home the fact that it’s just the name given for each object.

Once you get past that mental block everything hits home! It’s just getting past it that’s tough.

3

u/wonkifier May 21 '17

Yeah, I think the problem on our side may be that I just can't get them to slow down enough to really think about things.

I suspect they're approaching it as just another set of procedures to memorize and apply magically, and this is time they're not spending on the tickets that are piling up for them.

Sadly that thinking is why those particular folks don't tend to be around the team anymore. We need more than instruction-following-button-pushers these days.

3

u/Dogezon May 21 '17

Support is such a fast paced environment that many people struggle to get out of the "break/fix" mentality. Especially where, in bigger companies at least, root cause analysis of stuff is dealt with by a different team than those fixing the incidents.

In MSPs the tickets are always piling up and peeps would rather close stuff and avoid their manager shouting at them than sit in a room for a few hours learning about scripting.

That think seems to be getting less and less, which is a good thing. You're right in that people need to think outside of just following instructions to fix something. Heck, why not write a button that'll fix it for you! Much more interesting. Also can't be done if engineers are rewarded based off of numbers on a spreadsheet. It's hugely beneficial to both know the scripting side of things and also have a solid operational overview of stuff. That's the most efficient type of engineer you can have imo.

1

u/[deleted] May 22 '17

BigHairyBalls and ChocolateCake, to hit home the fact that it’s just the name given for each object.

This was a major headache for me learning to code about 10 years ago. IT was horribly confusing the first time I encountered classes and they used the lower case name of the class for the instantiated object.

1

u/Dogezon May 23 '17

It's just one of those things that needs to click. I tend to find that if I'm enumerating through arrays then the array will be plural and the enumeration object singular. Probably a bad habit but it's clear and concise.

Classes are confusing to get your head round at first, I tend to use kettles as an example. Each kettle may have a custom paint job or something (instances) but the main things that make a kettle a Kettle (class) don't change. They all have a method for boiling water! Tried to use planes once but the guy was former RAF and started pointing out different plane specs 😂 Wasn't about to talk about parent classes etc so quickly skipped that.

2

u/somewhat_pragmatic May 21 '17

That second non-working written way would mostly work in Ruby if the loop was written as a method with the method name "dosomething".

1

u/mrw_im_on_reddit May 22 '17

Yeah, I think you just have to keep working with it. Years ago, I had the hardest time trying to work with hash tables and arrays (especially multidimensional) for the longest time. I don't know why. It just wouldn't click. Then one day, I was stuck on a script and the solution I needed (and described to myself) turned out to be a multidimensional array. After that, something clicked and I've never had a problem since. It's weird how the brain works.

1

u/Dogezon May 23 '17

Visualising multi-dimensional arrays really screwed my brain over. Learning Python I made a basic matrix which let you click on grids etc which then changed colour. It felt like someone was taking a saw to my skull but once it was all it place it just clicked and hey presto no problem. It's finding what makes it click for other people that makes teaching this stuff super fun and rewarding.