Is Powershell Viable?

Graeme
9 min readFeb 2, 2021

Originally posted on ITBlogPros.com

Is Powershell Viable?

It’s a pretty open ended question, to be fair, but it is a valid one. What is the point of learning a programming language if it isn’t viable as a career skill? We want to outline some of the awesome things that you can do with the language, and find out what makes it a viable skill that you should build and develop towards your IT skill-set. The TL;DR is this: yes, Powershell is viable, both as a scripting language, and as an easy way to learn the basics of programming. Read on if you want more details, but the question has been answered here!

Is Powershell Viable

Many people often wonder what Powershell is good for? Not many tech professionals think that Powershell is a skill worth learning, often relegating it to the skill set of system administrators or DevOps pros. And they aren’t wrong: highly skilled IT pros rely on Powershell to get many different day-to-day tasks, such as automation and workflow optimization. But is it a viable set of skills to learn for entry level positions? The answer is overwhelmingly a resounding yes! If that is the answer you were after then we just saved you some extra reading, and you are welcome! 🙂

But for everyone else that might be wondering why Powershell is even worth learning, then we will cover a few different places that you can implement it in your own work life. This will not only make your time spent at work more fun, but it also has the potential to save you time and allow you to focus on the important stuff. We will be looking at a few great Powershell modules that you might consider using in your own home or office network in an upcoming article, so stay tuned!

What we want to do is look at how Powershell could be a viable solution for your hobby, studying or work related tasks. You might be amazed at the things that you can start to do once you learn how they work.

Where is Powershell Used?
You might not realize it, but Powershell is used almost everywhere within Windows environments. From File servers to website hosting platforms, Powershell can add real value to the automation of critical tasks on any of your Microsoft Windows based infrastructure. The built in cmdlets that Powershell has allows it to act just like a full scale application in some cases. You can have Powershell automatically lock user accounts if there is unusual activity, you can have it restart services when they stop, you can even have Powershell fire off an alert email if there is a critical event that requires urgent attention.

Microsoft may have originally developed this super tool for use within their own Eco-system, but the popularity, scalability, ease of use, and free to use status has made it a highly desirable programming language for many. So much so that Powershell can even be run in Linux. This is not entirely surprising though, considering the fact that many people have made the comparison between Powershell and Bash on more than one occasion.

The reason for it’s success is the fact that it is so easy to start learning. You can run your scripts directly from within the Powershell ISE, and it requires no compiling. All you need to do is either highlisght the code snippet that you would like to run and press the F8 key on your keyboard, or press F5 on your keyboard to run the entire script.

If you run into any problems then you will quickly find the error messages in Powershell not only tell you what the issue is, but also where the error is. By line number! If you have ever had the unenviable task of trying to troubleshoot a script or application without this kind of detailed information then you will really, really love Powershell’s ability to make quick work of bugs and errors. In this example we have misspelled the foreach operator and we get the following output:

The red text shows us where the error has occurred:

At line:2 char:11

+ forech($t in $test){

+
The command knows that the in syntax should follow the foreach command, but since it was misspelled, it no longer knows what to do with in.

This is a great example of how Powershell makes life all that much easier by highlighting your mistakes when they happen! That’s not to say that other programming languages can’t do the same thing though. In fact, most of the other languages that you will learn generally have a huge component attached to the dev environment that deals specifically with error handling and troubleshooting.

Also, don’t think that you have to stick to Powershell ISE as your IDE (Integrated Development Environment). Another great, free option is called Visual Studio Code. You can write almost anything you want in this application, not just Powershell. You can write in C#, Python, HTML, the possibilities are huge, so check it out!

What Makes Powershell Viable In My Career or as a Hobby?
As with anything, what you put into learning how to script, code and program is what you get out. (Think about how computer systems work: garbage in — garbage out) Spend the time to learn about all the basic concepts relating to Powershell, understand how a script runs, how to create loops, use Boolean (true and false statements), there is a lot to learn. In order to learn all of this stuff, you need to find a reason to keep coming back to it. For many people, this is possible whenever there is an element of fun attached to it, or an end goal in mind.

Personally, I prefer finding out about a problem that I have that could do with a quick hack, and then I start to think about how to get started with it. An article series that is coming up really soon on the ITBlogPros.com site is an email configuration manager that I created with Windows Forms and Powershell. Before I created this tool, I would have to remotely dial in and manually configure the mail accounts to get it working.

This took a lot of time and it was an inconvenience for everyone involved. With that problem in mind, I was able to focus on what I would like to do. Running commands simply wasn’t an option. I wanted to create a clean GUI that would allow the user to open the application, click on the options via a clean button menu, and then simply sit back and wait for the mail configuration to complete.

I was lucky because I had a clear idea about what I wanted to do, and I went about researching it and completing what I wanted to do. You can do the same very easily if you look around your home or work network. There are plenty of tasks that are begging for automation.

Do you hate manually backing up your computer to the cloud? Write a Powershell script that does it for you!

Are you tired of manually testing your network devices when you are having problems? Create a scheduled Powershell task that alerts you before you have an issue! Make a text adventure game! There are tons of projects that you can get started on if you want to learn how it all works.

Just look around and find something to learn how to do, and slowly apply your Powershell knowledge as it grows.

What Else Can Powershell do?
Many IT administrators make the analogy of Powershell being a Swiss Army knife with a built in command line interpreter. OK, maybe it was just me then, but that doesn’t make it any less valid. I have personally saved myself hundreds hours of my life by automating tasks. A particularly entertaining example of some automation that I completed around 5 years ago was a morning report that had to be manually created every morning before 07:00 AM.

I built a script that used another very useful tool called Selenium, which is a web based automation tester that I used for pulling web data every morning. It would take screenshots of the critical parts of the production website, and even output all the vital signs of all our infrastructure in a neat and beautiful looking report. The report still runs to this day, and I still hit my snooze button on my alarm clock at least 2 more times than I should.

Here are a couple other examples of what this stellar tool can do:

  • You can use it to write and create your own scripts and applications
  • You can use it to automate repetitive tasks and actions
  • You can use it in conjunction with powerful modules to expand the functionality of Powershell
  • It works over networks and the internet depending on what you need it to do
  • You can create GUI applications for fancy Winforms and and make it look like a fully fledged applications
  • Administer user accounts
  • Manage Mailboxes and File Shares
  • Much, much more!

Just looking at the list above you can already see that there is a ton to learn about this programming language, and there is great news. There are hundreds of free to use learning resources that drill down into the specifics without you needing to spend a cent. There isn’t very much in the way of standalone certifications for Powershell, so you might find that if you are wanting to get certified specifically in Powershell then you will have to do a bit of digging around.

The great thing about Powershell is that it gives you a pathway to learn more advanced programming concepts, and it will certainly help you to figure out some of the basics to get started. I am a firm believer that you should be able to dive into any subject that you are interested in, make some mistakes, and get your hands dirty ion the process. There is a ton of great lessons that you can apply not only to programming, but to learning in general.

A Little Uncertainty: Powershell Core
Probably the biggest reason you would even wonder about Powershell’s viability is the very thing that is making it more accessible to other platforms: Powershell Core. The short story is that in order to make Powershell Core compatible with these other platforms is that they have rolled back some of the functionality in order to make it work properly on Linux and Mac OS.

This is done by using a stripped down version of the .NET framework called .NET Core. There are some disadvantages with this new version, mainly that some of the original Windows based functions have been deprecated and they do not work with the core versions of Powershell.

This might seem like there is not much point to learning how Powershell works, but I would argue that this is the perfect time to start learning it. Not only will you be able to apply your skills to other operating systems if you understand the basic syntax and usage of Powershell. So generally, although there seems to be a bit of a setback with these early versions of Powershell Core, there will be enhancements that make the module a potentially universal way of scripting and creating apps on multiple platforms using a single framework.

Ultimately you will need to find a solution that not only keeps you interested, but also works for you practically. Much of what you learn through experimentation will have profound value when you get better with practice, and you will most probably find a place where you can use your new-found knowledge to create a solution of your own.

Conclusion
There we have it, is Powershell viable? Luckily for you, we answered the question right at the beginning of the article, so we hopefully saved you some time if you were in a rush. If you managed to make it all the way here, then thank you for reading! This is an impromptu take on what I think about Powershell. To me it has always been very difficult to learn any kind of programming language, so when I discovered the power and ease of use that Powershell offered I immediately jumped in and started to learn how it works, and how I could make it work for me.

Happy scripting until next time!

--

--

Graeme
0 Followers

I am an IT Professional and writer with nearly 20 years in the industry. Scripting, networking, and application development are all subjects that I enjoy.