We’re going to talk about how to learn PowerShell or how to learn some other language that you’d like to learn. First and foremost, the way to learn is not to watch YouTube videos, to not read articles, to not do online training courses, to not do physical training courses, to not read about PowerShell or any other language.
The real way, the only right way to learn about PowerShell is to learn by doing. Do what is in your current environment, your context. Build scripts that allow you to automate provisioning user accounts, creating virtual machines, deploying software. Do something that’s a pain point for you, not for anyone else.
Don’t go through all these examples of the fictional Joe character had this thing, and perhaps he was in this environment and anybody, me included, we have to come up with fictional examples that replicate real-world experiences, based on our experiences. But there’s no way that we can replicate your personal experience, so, the very best way is to learn by doing.
Let’s say I have a problem. I need to read a bunch of CSV files – I’m just taking up fictional levels because I have no idea what your environment is like it and the problems that you may come across. The first thing – you have a problem. I have a bunch of CSV files, Google PowerShell CSV file, and that will ultimately lead you to the Import-Csv cmdlet that would eventually get you to examples of foreach loops to loop through all the files.
You start there. You Google, hash it out, figure it out, run into another problem. Google again, hash it out, figure it out, run into another problem. Google it again – that is, by far and away, the best way to learn any new language.
We all do that, I still do that with just about anything, even with PowerShell now. The only difference is as you get more experience, you’ll just Google less, but you’ll still be Googling. You’re never going to know everything there is to know about a language. It’s just you’re going to be faster because you’re going to have the Google results right in your head “Oh yeah, I’ve been into that situation ten times already. I don’t have to Google that, I know the example, I know the reason, I know the solution.” That happens, by far and away the best. But that being said, I emphasize that a lot, there are reasons to use these other alternatives as well.
The most significant reason for me, you may learn differently, but the way I learn is when I’m first starting out with something. Let’s just say that recently I started to learn Python. Now, whenever I don’t know hardly anything there is to know about a topic, I will do a training course on it, or I will do a bunch of reading on it – reading articles. I’m to the point to where I don’t know what I don’t know yet. I just need to be exposed to a bunch of stuff to put a bunch of ideas into my head.
Which then I can think or I could jot down, note, then go back to Google some stuff, and figure it out. I can follow the demo projects and things that courses and articles go through, but it doesn’t solidify in my head until I do it for myself, do it for some real-world situation. Not only that’s real-world for somebody else, but it’s real-world for me.
That is, by far and away, the best way to learn. If you don’t know anything there is to know about a topic; let’s just say you’re in PowerShell. You don’t know about foreach loops or for loops – that’s when I would read an article on foreach loops or for loops and think “Okay this is for foreach loop, this is what it does, this is how it works. I kind of get the gist.”
You don’t want just to keep on and on, try to understand everything, and try to cram all that stuff into your head when in reality the stuff that you’ve filled your head with is it’s how the loop works, but you don’t get the context behind it. The context is that the kind of muscle memory like they say when you know if you want to remember something well, you have to associate it with a picture.
Years ago, I went through a little course called Mega Memory by someone whose name I cannot remember now. He had said that if you want to remember a word, you remember a picture from it. I still remember that 3 is a stool because I had a stool that had three legs at the time. I still remember that 4 was a car because that had four wheels. That stuff sticks in your head.
The way to make code stick in your head, these concepts hold in your head is apply them to something that you know you’re going to remember. Label them something in your environment whenever you think for each. You’ll immediately feel “Oh yeah that’s that time that I ran into the issue with that foreach loop that I had to loop through all these files, to do this thing.” It sticks in your head a lot more.
In summary, when you’re first starting out, when you don’t know what you don’t know, do the training courses, read the articles, do ebooks, and get on the forums and browse through.
Also, if you don’t want to get in and you’re like “Okay I need to learn this thing right now, to fix this problem,” just browse around. That’s another good thing. I browse stuff all the time on Twitter and the forums and read it – just to see “Oh yeah, this is kind of a neat way to do it; did never thought about doing it that way.” That’s another good thing, but if you want to truly learn and get hardcore about “I need to learn this thing” then, you have to learn by doing, you have to apply a particular concept to that thing you’re learning. It’s so important.