This year I wanted to focus mainly on improving my PowerShell skills. I started reading Practical automation in Powershell which is very interesting and fun because you get to follow along.
Sometimes I don’t get a lot of time or just don’t have the energy to do anything too intense or read. However to keep up the habit of growth everyday I like to do short exercises using the PSKoans module or from the PowerShell Practice Primer book.
PSKoans
PSKoans is a free resource that gives you simple exercises to fix or complete code snippets. It teaches you the PowerShell language through Pester unit testing.
At the command line you simply type show-karma
and you get an exercise. It gives you the line of code to work on.
You then type Show-Karma -Meditate
and the corresponding script file will open on VS code or your default code editor.
Below is an example of an exercise where you simply fill in the blanks fulfill the expected result
It 'is a simple string of text' {
'____' | Should -Be 'string'
}
Then you type in Show-Karma
again to see how you did. If you did it correctly you will see you progress in the output.
You also see the overall progress which is quite motivating.
To see a list of the different topics you can enter Show-Karma -List
PowerShell Practice Primer
This is another great resource. You can buy the book on Leanpub and you will get a link to download the exercise files. You don’t really need the files but I like to save the work and keep track of my process. You could also print them out and then score how you did by comparing with the solutions.
The exercises start at a basic level and get more complex as you go on. Commands like Get-Help
, Get-Command
and Get-Member
will be your best friends in order to complete the exercises.
The goal is to improve your proficiency in the command line, so no scripting skills required. The book assumes you have some basic understanding of PowerShell and have read something like the Learn PowerShell in a Month of Lunches book.
In closing
I really like these resources because they are nice and short and even if I do just one exercise a day I keep getting 1% better everyday which adds up over time.
Resources
PSKoans: A simple, fun, and interactive way to learn the PowerShell language
How to Build New Habits by James Clear
Pester - The ubiquitous test and mock framework for PowerShell | Pester
PowerShell Practice Primer by Jeff Hicks
Great content!!! I didn't know PSKoans and didn't think that kind of application could be done. It's a great resource as you mentioned to keep learning more about PowerShell.
Thanks for sharing it!!!!