Certifications / Microsoft

Why PowerShell is a Great First Language

by Brett Langis
Why PowerShell is a Great First Language picture: A
Follow us
Published on October 7, 2019

Scripting and automation are increasingly sought after skills for IT professionals. And PowerShell is a great choice to get started and set you apart. With the emergence of DevOps in recent years, adding these skills can help you propel your career. If you want to speed up your automation skills—and your career—then take a look at some of our Microsoft Windows Server training. They'll be sure to fast track your career path.

If you work in a Windows environment, which most IT professionals do in some capacity, you can start using PowerShell immediately. Whether you are responsible for servers or desktops, you can start using PowerShell to make your job easier. You don't even need to think like a programmer.

PowerShell is one of the best entry points into programming because it's widely used and easy to learn. Let's explore a smattering of solid reasons why PowerShell is a great first language for learners.

Apply Your PowerShell Skills Immediately

Many Microsoft products have a graphical interface (GUI), which is no more than a wrapper on top of PowerShell. With many languages, there's a pretty steep learning curve between "Hello World" and making your code work. Most code is pretty abstracted, but PowerShell makes use of cmdlets (pronounced, "command lets") that are predefined .NET command sets. There's a cmdlet for just about everything the GUI can do — and that's great to get you off into the shell.

Starting with simple one-line commands on the shell, you can get started scripting immediately.

PowerShell follows a syntax of 'verb-noun' that is extremely approachable. For example, if you wanted to get the properties of an exchange mailbox, you can open the Exchange shell and run the cmdlet:

1         get–Mailbox

You can then filter the output, select only the fields you want or pass the results of that command to another command.

If you wanted to make changes to the mailbox you would use:

1                    set–Mailbox

These simple one-liners both teach you PowerShell basics and also what is possible (which is everything). Most importantly, you get a good jolt of immediate satisfaction, and that's great when you're getting ready to ditch the GUI.

You don't have to start thinking like a developer, yet. But that'll be important later when you're replacing your existing login batch scripts, doing inventory reporting using WMI or automating problem resolutions.

It's Easy to Quickly Advance in PowerShell

PowerShell is one of the easiest languages to get started with and learn for multiple reasons.

As mentioned before, PowerShell follows a "verb-noun" convention, which makes even more complex scripts easier to use (and read) than a more abstracted language like .NET. For instance, you can do quite a bit with the "–get" and "–set" commands. PowerShell has the ability to pass the results of a "get-" command to a "set-" command. This makes batch operations easy and extremely powerful.

Take a look at something like this:

1  Get–Mailbox | Set–Mailbox –ProhibitSendQuota < Value > –ProhibitSendReceiveQuota < Value > –IssueWarningQuota < Value >

It looks more complicated than the get-mailbox command earlier, but this is still one line of code. The idea behind the command is to retrieve all the mailboxes in the organization and set the mailbox limits on all of them. PowerShell does this in one line. This could be three mailboxes or 5,000. This is the wonder of PowerShell. But what if you only wanted to do one department?

1
2  Get–User | where {$_.Department –eq "Sales"} | Get–Mailbox | Set–Mailbox
–ProhibitSendQuota < Value > –ProhibitSendReceiveQuota < Value > –IssueWarningQuota < Value >
3

Now, there are a few things happening here. It's important for us to know what information lives under what object. We would have to know that the department field is under the user and not the mailbox, but we'd have to find that out in the GUI, too. So, we're getting all the users in the Sales department, then retrieving all their mailboxes and then setting their mailbox limits to our desired size.

In one line of code, you've learned conventions that you can apply across the vast majority of cmdlets. Not only is this fairly readable, but the amount of code required to do this in almost every other language would be much higher than PowerShell.

Besides having a format that is easy to learn, PowerShell has a large and active community, and extensive help documentation.

Blogs like "Hey Scripting Guy!," repositories like the TechNet gallery, and even the very robust built-in help (get-help ), makes getting started and getting incredible results easy.

PowerShell Is Powerful and Versatile

While PowerShell is primarily a scripting engine, that doesn't mean it's limited. It's extremely powerful. PowerShell is built on top of .NET, which means it can call .NET methods natively to accomplish tasks — even if the built-in PowerShell cmdlet doesn't support it. On top of that, PowerShell can also run anything that you can already run from the command prompt.

Windows has a lot of legacy applications that have their own command line arguments that do not yet have an equivalent in PowerShell. If you have a large collection of batch files, that means you could start rewriting them in PowerShell and still use older code. That is if you don't find an easier way to accomplish your task in PowerShell.

For the absolute beginner, this might not mean anything. However, advancing in a language means you'll eventually run into limitations. To solve a problem may mean learning a new language. PowerShell is powerful on its own, but often eventually leads to learning other languages like Bash, Perl, and Python. Because PowerShell is easier to learn than other languages, you'll find your limitations sooner — and having one language makes it easier to pick up a second (and third).

PowerShell Is Now Cross Platform

PowerShell has been rewritten and released as a new platform called PowerShell Core. PowerShell Core runs on Mac, Linux and Windows. It's the go-forward platform for all PowerShell development and signals Microsoft's commitment to delivering a mainstay language akin to something like Python.

As previously stated, PowerShell is THE management tool for many Microsoft productsExchange, SharePoint, Hyper-V, Office 365 and Azure. Azure can become its own specialty and lead you into the world of public cloud, containerization, and DevOps. Oh, and knowing PowerShell can help you in earning a variety of Microsoft certifications as well.

Most importantly, cross platform means if PowerShell is your first language, you can bring it with you to Linux, Mac, and Windows. PowerShell is more portable than ever — and that's a great thing if it's your first language.

With its power, tight integrations, and being cross platform it's no wonder why PowerShell is a skill that is highly in demand.

PowerShell Will Get You a Job

PowerShell is increasingly sought after as a top skill for DevOps positions. Puppet conducted a survey of 3,200 IT professionals in 2017 and found nearly 30% of the IT professionals surveyed were in a DevOps role. This was almost double the number from three years earlier. The DevOps job market is huge and infrastructure automation is a critical skill set for a DevOps engineer.

One of the other major scripting languages often looked for is Python. Python had an advantage early on over PowerShell by being cross platform. With the release of PowerShell Core, expect to see increased adoption of PowerShell as a core infrastructure automation language of choice.

If you're not looking at jumping on the DevOps bandwagon, PowerShell is still a great skill to have. Scripting routine tasks saves time and delivers predictable results, ultimately making you a more efficient sysadmin.

In the end, whether it's DevOps or systems administration, it is extremely likely that PowerShell will be featured in a job advertisement. Adding it to your resume may just land you your next big raise.

How to Get Started With PowerShell

PowerShell's simple syntax, power and tight integration to Microsoft products makes it the perfect language to start learning to script with. Make no mistake, PowerShell is not limited to being a "starter language" and can be a specialty that leads to big employment opportunities.

There's no reason to not start learning PowerShell, even if it's not your first language.


Download

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.


Don't miss out!Get great content
delivered to your inbox.

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.

Recommended Articles

Get CBT Nuggets IT training news and resources

I have read and understood the privacy policy and am able to consent to it.

© 2024 CBT Nuggets. All rights reserved.Terms | Privacy Policy | Accessibility | Sitemap | 2850 Crescent Avenue, Eugene, OR 97408 | 541-284-5522