Windows PowerShell, the command line shell and scripting language for system administrators, is the de facto standard for automating just about every Microsoft product imaginable. It has even made its way to Linux.
The ability to automate a variety of tasks and processes has become a critical skill for IT professionals, so there’s no better time to embrace the PowerShell command line and start learning how to script.
Everyone learns PowerShell differently, but I recommend a three-step approach to master this scripting language: explore, train and build.
1. Explore PowerShell's Utility
The first step is to simply open a PowerShell console and use your current knowledge to see how the console responds. Just type anything; for now, it doesn’t matter what. As you have questions, use the Get Help command extensively. PowerShell’s help system is a wonderful resource and can give the beginner a wealth of information. Also check out the Get Command cmdlet, which shows all the commands available to you. Do any look interesting? Try them out and see what happens. You probably won’t break anything.
2. Find a PowerShell Training Option
Next, take some form of training, whether self-guided or with an instructor. If you go the self-training route, consider the following resources:
Want to use your lunch break to hone the new skill? Check out the book Learn Windows PowerShell in a Month of Lunches.
Watch “Getting Started with Microsoft PowerShell” from Microsoft Virtual Academy.
- Pluralsight offers numerous online courses for all levels of PowerShell ability, from beginner to advanced.
These resources will introduce you to PowerShell and get you comfortable with the basics, such as syntax, what the console looks like and how it behaves.
3. Build Your First Script
You’ve gotten your feet wet and have a few hours of training under your belt. Now it’s time to build your first useful script.
It’s crucial to learn PowerShell by doing, and this is one program where tinkering pays off. For scripting and automation concepts to sink in — and to help your brain digest what’s possible with PowerShell — you must apply your newfound knowledge to a real-world task. You’ll make lots of mistakes, which is normal, but learning how to fix those mistakes will solidify your understanding.
Pick a real task that you believe is ripe for automation. Choose something small that you do repetitively, following the same actions every time. Tasks like creating user accounts or provisioning mailboxes are great starter tasks. Try to use PowerShell to accomplish a task that you’ve always done in a graphical user interface.
Keep this code handy as you start to build your script library. Use these early efforts as a springboard to create larger, more complex scripting tools for your environment. Before you know it, you’ll have mastered the art of automation with PowerShell.