What if you could bring the productivity of Linux over to Windows? One of the main differences between Windows and Linux is that most Linux distros come packaged with the powerful Bash shell; by comparison, the command prompt in Windows is barebones. What if Windows had an equally powerful terminal?

With PowerShell, that dream could become reality.

Disclaimer: PowerShell is not "Bash for Windows" nor is it meant to be. Yes, both are command line environments that can greatly improve your productivity, but that's where the similarities end. You should view PowerShell as its own separate approach to creating a powerful command line environment.

What Is PowerShell?

PowerShell can be thought of as a massive upgrade to Windows command prompt. It can perform a lot of the same tasks (e.g. navigating the system, interacting with files, modifying properties), but opens up the entire .NET framework for maximum power. To understand the benefits of this, keep reading.

There are two core benefits that make PowerShell better than the traditional command prompt: extensibility and scriptability.

productivity-windows-powershell-overview

While PowerShell does come with an initial set of commands, you can add your own commands by creating cmdlets. Cmdlets are classes that are created using the C# language and when they're called, they are executed within the PowerShell environment. Because they are written using C#, cmdlets have access to the entire .NET framework.

The .NET framework contains a huge library of code provided by Microsoft. When writing your own cmdlet, you have access to all of that code. Pulling process information? Cryptographic algorithms? Database connectivity? Network communications? All of that — and more — is provided by the .NET framework, which means most of the work is done for you. You just need to piece it together by calling the right functions.

Microsoft has made it clear that PowerShell isn't going away — in fact, the upcoming package manager in Windows 10 will be based on PowerShell — so everyone should consider learning it sooner rather than later.

Why PowerShell Is Awesome

PowerShell has plenty of advanced features, most of which may only be relevant for Windows programmers and server administrators, but there are several basic features that are simple to understand, yet extremely useful for everyone.

Simple but powerful. The PowerShell environment is easy enough that anyone can pick it up within a few hours of reading. There is a learning curve, but it's relatively shallow and you don't need to learn all of it to make use of it.

Detailed process information. It's one thing to use an alternative task manager, but PowerShell allows you to perform some neat tricks as far as process management is concerned. Start with the native Get-Process and Stop-Process cmdlets.

productivity-windows-powershell-process

Easy automation and scripting. Basic Windows doesn't provide an easy way to automate tasks. Prior to PowerShell, batch files could only perform primitive scripting while third-party solutions were needed for automation (e.g. Perl, AutoHotkey). But with PowerShell, you can schedule tasks to run at a certain time or interval.

For example, with the ScheduledTasks module, you can cause a specific program or process to execute according to a trigger (e.g. at a specific time, when a system event occurs, etc.) and you can define the context for that task (e.g. security limitations).

Command piping and logic. In Bash (Linux), commands can be piped together such that the output of one command can be used as input for another command. For example, the basic Get-Process cmdlet outputs information for all running process. What if you only want info from a subset of processes? You can pipe it with the Where-Object cmdlet, which acts as a process filter, to only execute Get-Process on the processes returned by Where-Object.

PowerShell also provides a few native commands for conditional logic (e.g. If, Else, For, Switch) that can be used to control the flow of cmdlet execution. For example, you could create a PowerShell script that only executes certain cmdlets when certain conditions are met (e.g. clean up processes when RAM is close to full).

Remote and background jobs. Not only can cmdlets be executed as background processes (so you can run multiple tasks at once asynchronously), but many cmdlets can also be executed on remote machines on the network as long as they have been configured to do so. Cmdlets with remote capabilities will often provide a ComputerName parameter that you can indicate when executing said cmdlet.

For more information, check out this TechNet page on running remote commands with PowerShell.

Download third-party scripts. You don't actually have to extend PowerShell yourself. Several online repositories allow you to download and make use of public scripts and cmdlets that others have created.

Where To Learn PowerShell

Ready to get your hands dirty with PowerShell? Here are a few resources that are often recommended to newbies who want to get learning as soon as possible:

PowerShell Tutorial by Don Jones. This YouTube video series focuses on PowerShell 2.0 (the version that comes packaged with Windows 7), which is a bit outdated now, but offers a good introduction for those who have absolutely no scripting experience. Each video is only a few minutes long, but there are 99 of them, so it's rather comprehensive.

Microsoft Virtual Academy. MVA offers lots of Microsoft-related courses for free, including two on PowerShell 3.0. There's the Getting Started course and the Advanced Tools & Scripting course. Both courses contain 9 lessons that are each around 1-hour in length.

productivity-windows-powershell-tutorials

TechNet Script Center. The TechNet section of Microsoft's website includes a lot of great links to PowerShell guides and tutorials. As a bonus, if you navigate to the Repository section, you can browse and download various PowerShell scripts.

Hey, Scripting Guy! Blog [Broken URL Removed]. This is an "all about PowerShell" blog with a LOT of great information that dates back almost an entire decade. New posts are published every day and they're categorized by tags for easy browsing. If you don't know where to begin, start by browsing the Getting Started tag [Broken URL Removed].

Is PowerShell For You?

What do you think? Will PowerShell help your productivity on Windows? Or is it too much of an overkill for your needs? Share your thoughts with us in the comments!