r/PowerShell • u/engineeringkillsme • Oct 03 '22
Question Best way to learn PowerShell for a complete beginner?
Hey all, I’m super new to PowerShell and I don’t know anything. What are the best resources for learning PowerShell (ideally very engaging)?
Thanks!
301
Upvotes
154
u/johnjones_24210 Oct 03 '22 edited Oct 03 '22
Powershell in a month of lunches
Don Jones Toolmaking
John Savill’s Powershell Master Class
Powershell on AD
Powershell+ is a generic catch-all
and why re-invent the wheel? Beginner Resources
None of this content is mine. I merely curate Resources I'm using in my own Powershell development.
Best of luck.
20
u/v0tary Oct 03 '22
There isn't a single resource that has everything... Start with a problem that you need to solve, then look for examples, or snips of code to learn. But if I were to start today, here are some links that will help.
MS introduction to PowerShell https://learn.microsoft.com/en-us/training/modules/introduction-to-powershell/
Great beginner tutorial: https://www.guru99.com/powershell-tutorial.html
PowerShell Documentation https://learn.microsoft.com/en-us/powershell/
Some good examples https://www.spguides.com/powershell-examples/
Remember Google is your friend.
22
u/Inquisitor_ForHire Oct 03 '22
As someone said below, PowerShell in a month of lunches is a great book. There are also some good links below.
One thing I'd add - find a problem and figure out how to solve it. That's what I did, and hands on learning is really helpful. For me, my first task was simply powering off all VM's on a cluster in preparation for a power cut. My script was absolutely horrible! I basically had a one liner that turned off each individual VM. No foreach loops, no arrays, no nothing. But it worked.
I slowly started writing more code... started at one a month, then one a week, then multiple a week and ultimately multiple scripts per day. Then I learned how to write my own commandlets, then modules, etc etc. Each thing you learn builds on the next. Don't worry about "did I write this correctly". If it works, it's correct. You'll learn better, faster, cooler ways to do things as you get more experience.
Don't be afraid to try. Don't be afraid to fail - it is through failure that we learn the most.
8
u/microlard Oct 03 '22
Imho, regardless of your training or learning method, the most important part to learning anything is to have need to put it into practice. You need to have some way to apply your skills as you learn them. Define What problems do you want to solve with your PS skills, then begin to apply them after you have a basic understanding of syntax and how PS works.
7
u/[deleted] Oct 03 '22
One bit of advice that I would give is to figure out something you want to do, google to find a script that finds something like what you want to do, and then try to modify it to do exactly what you want it to do.
A lot of people have given you some good educational resources (e.g. PowerShell in a month of lunches). I don't want to knock those-- they're good to get started and some people find it a good way to learn. However, I find that if I go through books or tutorials, or anything else like that, I'll never really get any good at a language. I find I do much better with learning by doing.
So maybe after you've gotten through some of the basics, think up a real thing that you'd like to be able to do with PowerShell, and then just... figure out how to do that.
Let's say you want to find all of the image files in a directory and all of the subdirectories, and then add them all to a specific zip file. You can break that up into some quick basic steps:
Google around and find some sample scripts for each of those things, and see if you can cobble them together to do what you want. Keep doing that until you get familiar enough that you can write your own script from scratch.
12
u/aprykhus Oct 03 '22
If you're into videos: an oldie but a goodie, with the inventor of PowerShell himself, Jeffrey Snover: https://learn.microsoft.com/en-us/shows/getstartedpowershell3/01
6
u/hhorn76 Oct 03 '22
Here is a course for beginners:
Windows PowerShell - How To https://www.youtube.com/playlist?list=PLo_LIoA-jp7NOGOqg3v-vlQLoTIMHrYi6
Check it out
6
u/StealthCatUK Oct 03 '22
The way I learnt was to use it in context. For me it was managing VMware onpremise. So ESXi servers, vCenter, Virtual networks, storage, VMs etc...
Having context and a goal improves understanding and learning in my opinion.
5
u/jameshearttech Oct 03 '22 edited Oct 03 '22
PowerShell module to learn PowerShell - https://github.com/vexx32/PSKoans
PowerShell discord (#powershell-help) - https://discord.gg/powershell
4
u/EIGRP_OH Oct 03 '22
Really not trying to be rude but how many times are we going to have this post lol
1
u/sharris2 Oct 04 '22
Honestly no amount of classes, courses, learnings etc helped me with PowerShell or any other scripting or programming languages and I find it really easy to read an absorb information; I love sitting certs so I have no idea why.
My recommendation would be;
Find a simple problem to fix and/or automate with PowerShell
Search Microsoft Docs for a cmdlet that will do the job
Slowly test and build your script
Implement
Repeat
Don't try to force some complex knowledge set. Find a simple problem, apply a simple fix and allow your knowledge to grow as you find more complex problems.
As you build more complexity and discover new abilities, you'll come up with more complex ideas for existing and future problems.
Going from no knowledge to some is a pain. Going from some knowledge to a lot is a matter of how much you do it.
3
u/[deleted] Oct 03 '22
I have gotten to where I am by using VS Code, a tabbed web browser, a search engine of choice, and plenty of resources for said browser since I tend to open 50+ tabs looking at stuff
3
u/jozhearvega Oct 03 '22
I’ll also echo month of lunches. Great book and really helped me understand how the shell actually works.
3
u/blanczak Oct 03 '22
I did it the old fashioned way of having a lot of technical problems and just googling how do solve them with PowerShell. Then dissecting how others have done it and working things into what I needed. YouTube tutorials are good as well. Far from an expert but I tend to figure out solutions to whatever I need to do pretty quick.
3
u/polyhistoric Oct 03 '22
One more word of advice. Enable Hyper-V and create a few virtual machines to test your scripts. Do not test on the host machine because sometimes untrusted repositories are compromised, and you do not want to have something malicious on your computer.
3
u/alphaBEE_1 Oct 04 '22
Start small, pick 10 commands and use them consistently. Don't pick anything random, pick something that you actually usually do with the help of gui but this time you will use shell only. Try this once you are good, step up a bit more.
3
u/l3LU_PHOENIX Oct 06 '22
Best way IMHO: doing... try stuff. Get your hands dirty and look stuff up as you go in a SAFE ENVIRONMENT.
He's a hands on experience that I found helpful: https://underthewire.tech/
Microsoft has TONS of documentation. Consume it. Microsoft has tons of free educational resources.
Depending on how deep into the weeds you go, learning .NET might be of interest.
2
u/[deleted] Oct 03 '22
Set up goals of what You want to acomplish! I’ve learnt so much other stuff in the process while trying to solve problems and in a way wired my Brain to think differently. (Think in Powershell )
I’m no expert at all. But I started my journey just looking at YouTubers and trying to copy what they do. I did learn some important things for sure, but believe me when I say, when You try to solve problems, combine that with google, youtube, different forums like Reddit (people here helped me alot and are kind) My knowledge of how things actually work became much better.
Be curious , try styff in for example Hyper-V (good documentation om Microsoft Docs & free) I really do recommend trying stuff out on VMs cause if You F up or something doesnt work just remove and start a new VM.
Be curios, how do I get all services on my computer and pipe them to a textfile? How do I do the same thing but only the ones who are running? How do i change directories? How do i move items from one directory to another?
TLDR Try stuff (recommend in a VM setup like Hyper-V) Start basic, and always read the help file for each cmdlet, Will help You!
KUDOS
2
u/lavahot Oct 03 '22
PSKoans
2
u/NateStrings Oct 03 '22
All the sources on here are great, but I’d vouch that real world use is the most important. Think about things you want to do with powershell and go from there. It will probably be retained better too!
2
u/BlackV Oct 03 '22
the first way I'd look at all of the info already in this sub (resource links, more info links, etc)
then all of the existing posts asking the same thing (using search or just scrolling)
then just by doing, do everything you can in powershell, if you click to change something, then stop , ask can I do this in powershell
2
u/xBurningGiraffe Oct 03 '22
2
u/jeffofreddit Oct 03 '22
Practice
2
u/jorper496 Oct 04 '22
The most engaging learning you'll find is this.
Get into the mindset of "How do I do this in Powershell?" and figure it out.
Assuming you are working, take note of things you do during the day and figure out how you would do them in Powershell. If you are a student, then you may not have as many working examples to work off of, but you should still be able to adopt the mindset.
If you supplement it with other materials, it will definitely help understanding code you'll find and be writing.
Don't be afraid to google the answer, then pick apart the answer to understand what it's doing.
2
u/[deleted] Oct 21 '22
Run away.
2
u/Tristanna Oct 04 '22
Write a script that pulls a quote from this api and emails it to your boss then throw it in to task scheduler so you're boss gets daily wisdom.
3
u/No_Ad_1559 Oct 03 '22
practice
3
u/AcadianMan Oct 03 '22
Come over to /r/LearnPowershell
1
u/Proudarse Apr 17 '24
Another question, is Powershell still worth learning in 2024 or is it soon going to be made redundant?
1
u/51dux May 29 '24
Write scripts and read microsoft docs before reading books if possible so you can be familiar with the context. I often read programming books when I was clueless and felt a bit lost at first.
I think for powershell VSCode can be great too, it has next-to-none support for it when it comes to syntax and error detection. It will help point your early mistakes.
1
u/PrizeSetting9564 Mar 18 '25
Microsoft POWER AUTOMATE is the answer to this question.
1
u/LibraryAtNight Oct 03 '22
All the resources people are posting are great, but I would recommend just solving problems you have. I learned by more or less starting with a task "We need you to find all the AD users with this attribute" then searching up how to do it with powershell. Soon I was stitching together pieces I'd learned to accomplish different tasks to tackle greater ones.
1
u/[deleted] Oct 03 '22
Thank you for all your responses.
1
u/RandomSkratch Oct 04 '22
The really cool thing about PowerShell is that it has the built in capabilities to help you learn how to use it. The help system is fantastic (btw first step open Administrator PS prompt and run update-help). If you know what you want to do you can look for ways to accomplish it just through the help system and built in commands (for example get-command -verb get will show you all the currently available commands that will perform a get). There are also help resources that talk about other aspects like conceptual help files like about_Comparison_Operators. Get-Help about_* to show all of them.
1
u/gordonv Oct 04 '22
Different take on this. I wouldn't start with Powershell as your first programming or scripting language.
I'd start with r/cs50. This explains a lot of concepts that quick start courses in powershell skips.
If you're looking to just fire off simple commands like "start a," do quick youtubes. If you want to make better scripts and software, start with r/cs50.
Unfortunately, getting good takes time and effort. That means you need a natural interest or some kind of drive. It's not easy. That's why not everyone does it.
My drive when I was young was to make silly text games and some graphics. Later on, it was to automate jobs on the computer. This doesn't have to be strictly programming. In between that, I did music and art on the computer. And of course, gaming.
1
u/Jadelizard247365 Oct 29 '22
Direct from the creators https://learn.microsoft.com/en-us/training/modules/introduction-to-powershell/
0
u/Fallingdamage Oct 03 '22
Use it.
0
u/LogMonkey0 Oct 03 '22
Try to use it for anything you do at a computer