What to learn as a beginner in PowerShell


I’ve been asked several times already by some colleagues how they should approach learning PowerShell. I realize that at first, it might seem frightening with too much knowledge to cover and not enough time and I remember I felt similarly when I was diving for the first time into PowerShell.

Therefore, I thought that having a list with most of the main topics to focus early on, could be a great resource. Below I collected links to what I think are the key points someone should focus on when beginning their PowerShell journey.

What is PowerShell

PowerShell is a command-line shell and scripting language which runs on top of .Net, either .Net Framework for Windows PowerShell (PowerShell up to version 5.1) or .Net Core for the new PowerShell Core releases (starting with version 6). As opposed to the majority of shells, PowerShell does not work around text, it deals instead with objects from the .Net layer.

Help

Learning how to properly use the help and discovery capabilities of PowerShell is essential to reach proficiency with the language.

Operators

Operators are some of the building blocks you use in PowerShell and part of commands and expressions.

Functions

Functions are a list of statements scoped under a name that can be invoked once the name is specified somewhere in code or command prompt. It is recommended that functions are named following the Verb-Noun format.

Error Handling

Error handling focus on what to do when things don’t go as expected, which will always happen unexpectedly :). Seriously, taking care of possible errors, whether external errors o trigger internally by your own code, is one of main differentiators between a quality and ready-to-share script vs a throwaway implementation.

Pipeline

Pipeline is a powerful PowerShell feature with a lot of application. The main concept behind the pipeline is the ability to orchestrate complex behavior by combining smaller, independent utilities.

Scopes

Scopes in PowerShell delimit how variables, aliases, functions and PSDrives how and where can be accessed.

Testing

Of course, I couldn’t finish the post without mentioning the need for tests. As your scripts grow in complexity, testing becomes one of the most important tools at your disposal to improve quality of the code, make easy to introduce changes without introducing bugs and set expectations for your scripts. For this, in PowerShell we use Pester, which provides a BDD style for test development.

Conclusion

Starting learning something new, specially a new language, it can seem daunting at first, since we don’t know where or how to start. But that’s ok. As time passes, things will start falling into place and they will become easier to understand. I hope that this small list will help navigate some of initial uncertainties and fears about PowerShell and push to move forward to the next level of your professional journey in PowerShell.

To conclude, thank you so much for reading this post. Hope you liked reading it as much as I did writing it. It was quite different than my previous post because all the gathering of links and posts to mention. But it was really fun. See you soon and stay tuned for more!!

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.