Why You Should Use PowerShell

There are times you need things to run automatically for you when it comes to deploying websites. It's not that deploying them is hard, it's just repetitive. At some point it may be easier for you to write a short little script that will do all of the legwork for you. That's where PowerShell can come in. PowerShell is a game-changer when you have access to the server your website is on.

Why you would use it

Let's get straight to the point. You should consider using PowerShell if you have tasks that you want to run automatically to manage operating systems and their processes. So you could write a script that changes someone's background every time they click a certain button. Or you could do something like write a script that restarts the process for your website after all of the files have been uploaded.

There are a lot of uses for PowerShell when you have a lot of processes that need to run at specific times under certain conditions and you don't want to wait for each process to finish to start the next. You can even do things like convert Excel files into Word files if you need to make a report based on the same data every time.

Another important reason you might use PowerShell is if you want to keep consistency in your processes. Once you write a script, it will execute the exact same each time. You don't have to worry about missing a step or having a typo somewhere. It even creates logs so that you can track any errors that occur at each and every step of the process.

How to use it

PowerShell is both a command line interface and a scripting language. You do have the option of using its integrated scripting environment if you don't want to use the command line in the beginning. The scripting language is a little similar to Perl and the command line is similar to the terminal in Linux.

One important distinction to make here is that PowerShell is not the same as the Command Prompt. PowerShell has more flexibility to work with different programs on the system instead of just the DOS. Another thing you need to know about PowerShell is that it was built using the .NET framework.

That's an interesting point because it means your scripts can use .NET interfaces and you can embed PowerShell scripts into your .NET code. This feature gives you so much more power than the Command Prompt does. You can do actual operating system management in the back-end of your code. If you can implement this the correct way, you have the potential to save yourself a lot of time.

PowerShell also uses cmdlets instead of commands. This subtle, but powerful difference lets you have direct access to the registry management and other system admin functionality. You can use this access to make updates to user permissions and other data on the system.

Getting started

You have the ability to really work with your data using PowerShell because the data from the cmdlets are objects. Playing with the clipboard cmdlets will give you some good examples of how great it can be to have your data stored in objects.

Actually, playing with the clipboard cmdlets is a great way in general to start understanding the PowerShell. It's not overly complex where you will get lost but it's not so simple where it seems pointless. Check out these two cmdlets just to get you started: Get-Clipboard and Set-Clipboard.

It might take a little time to get used to using PowerShell and to learn to see opportunities for using PowerShell, but that's like with anything else. And just like with anything else, once you really understand PowerShell, the way you work will change. Or at the very least the type of pranks you can play on your friends will be next level.

Have any of you written any crazy Powershell scripts to prank people? Or for you know, useful stuff? I'd love to hear your experiences in the comments. 🙂


Hey! I know some of you are struggling with understanding what happens on the back-end of development and that's ok. On Apr. 28th, I'm hosting a live webinar where I'll teach you about the .NET Core framework and C#. It'll only take an hour and by the end of it you'll have a solid understanding of classes and an app you can show people!

If you want to learn all this stuff for free, go register for the webinar by clicking here. Registration ends Apr. 27th so don't miss your chance to learn something important for free!

Learn Something New Everyday,
Connect With The Best Developers!

Sign Up Now!

& 500k+ others use Hashnode actively.

Comments (1)

Mark's photo

I originally learned Bash (after a little tcsh), and I still use that on Linux.

But I learned some amount of Powershell for Windows use, and it definitely is an improvement. The main one of which is that not everything is a string!

I think shell scripting is hard because of a lot of unfortunately choices made long ago. But it is hard to change, because nobody really wants to sit down and learn a lot of shell stuff. I know I don't. It's just something you gradually pick up because you want to or have to automate tasks or do system configuration.

There are plenty of technologically-better alternatives to popular shells, but unless a huge company ships it to everyone's computer by default, it's hard for it to catch on. Even harder than application languages, I feel. So I'm personally happy that Microsoft made it happen.