PowerShell is an open-source, object-oriented task automation engine and scripting language that utilizes a command-line shell to interact with and manage computing systems. Developed and maintained by Microsoft, PowerShell is a popular tool among the IT community to manage systems and automate both simple and complex tasks. The newest versions of PowerShell offer cross-platform support, running on Microsoft Windows, Linux, and macOS.
In the early 2000s, Microsoft identified a need for a more robust administrative automation solution. Early command-line interpreters (CLI), such as COMMAND.COM and Command Prompt (cmd.exe), offered limited functionality and control of the Windows graphical user interface (GUI).Consideration was given to porting existing Unix tools to work on Windows, but these efforts were later scrapped because of the fundamental architectural differences between Linux and Microsoft Windows operating systems. Ultimately, the team at Microsoft determined it would need to develop an entirely new solution from the ground up.
Microsoft began developing a new command-line management system in 2002 called Monad. In August 2002, Jeffrey Snover, Monad’s chief architect, released a white paper about the project called the “Monad Manifesto”. The whitepaper documented the shortcomings of existing solutions and detailed the architecture, advancements, and value offered by Monad.
In October 2003, Microsoft publicly demonstrated the platform at the Professional Developers Conference in Los Angeles. Over the next couple of years, Microsoft released several private and public betas of Monad. Finally, in April 2006, the name was changed to Windows PowerShell, which coincided with the release of PowerShell Release Candidate (RC) 1.
In 2016, Microsoft announced that PowerShell would become open-source and cross-platform, supporting Windows, Ubuntu, macOS, and CentOS. During this transition, two iterations of PowerShell became available, Windows PowerShell and PowerShell Core. Windows PowerShell continued to rely upon .NET Framework while PowerShell Core ran on .NET Core. When PowerShell 7 was released, Microsoft dropped the term Core from the product, and it serves as the replacement for PowerShell Core 6 and Windows PowerShell 5.1.
With PowerShell heavily integrated into all currently supported versions of Windows desktop and Windows Server operating systems and freely available to macOS and Linux users, anyone who wants to can use PowerShell. However, the userbase that benefits the most from PowerShell is IT professionals and power users, especially those that can leverage PowerShell’s automation capabilities.
A better question might be, “What can’t PowerShell do?” Microsoft and the PowerShell community have heavily invested resources into ensuring PowerShell is extremely capable with few limitations. PowerShell can efficiently handle everything from renaming files to managing enterprise-level domains.
Here are some examples of what PowerShell is commonly used for:
Starting and stopping services
Modifying the registry
Returning system configuration information
Manipulating files and folders
Interacting with APIs
Keep in mind that this is not a complete list of what PowerShell can do. With its functionality and versatility, PowerShell is often only limited by one’s imagination and or skillset.
Choosing the right PowerShell console largely depends on what you’re trying to accomplish. Are you writing a full PowerShell script or just running a few commands? Here are a few of the most common PowerShell consoles and when you might use each.
PowerShell CLI (command-line interface): A CLI is a text-based shell for interactive access to OS functions, files and folders, or services using commands. CLIs are generally bare bones and offer very limited GUI (graphical user interface) interaction. CLIs are great for simple commands and system management.
Windows PowerShell Integrated Scripting Environment (ISE): The Windows PowerShell ISE has been included in the Microsoft Windows operating systems since Windows 7 SP1. The Windows PowerShell ISE is a graphical user interface designed to help users build, modify, test, run, and open PowerShell scripts. While still popular, Microsoft has dropped feature development for PowerShell ISE, though it continues to receive security and high-priority servicing fixes. Additionally, Windows PowerShell ISE only supports up to PowerShell version 5.1 and does not support newer versions, like PowerShell 7.
Windows Terminal: Windows Terminal is a dedicated console for all your favorite command-line. Think of it as a more advanced PowerShell CLI that works with other shells, including Command Prompt, Git Bash, Azure Cloud, Ubuntu, etc. Windows Terminal helps organize your command-line windows with tabs and split windowpanes and allows you to heavily customize your experience with backgrounds, color schemes, customizable shortcuts, and themes.
Unlike other CLIs, PowerShell commands are known as cmdlets (pronounced command-lets). PowerShell cmdlets are instances of .NET classes and not stand-alone executables. For example, the commonly used command prompt command, ipconfig, runs the ipconfig executable.
PowerShell cmdlets follow a Verb-Noun naming scheme—for example, Get-Help, and Start-Service. This naming format makes it easier to remember PowerShell cmdlet names and understand what they do.
PowerShell 7 has over 1,500 cmdlets built-in, and you can add additional cmdlets by importing PowerShell modules. Some commonly used PowerShell modules include the NetworkingDsc module and the PSWindowsUpdate module. To view other popular PowerShell modules, check out the PowerShell Gallery, which contains an extensive collection of Microsoft- and community-developed modules.
To get a list of all the currently available cmdlets in your PowerShell environment, run the Get-Command cmdlet.
While CMD and PowerShell may look similar (especially if you are running the PowerShell 7 CLI) and their design objectives are similar, there are more differences than similarities between these two shells.
The most significant difference between CMD and PowerShell is that CMD relies upon a relatively short list of internal commands and stand-alone executables that return text string results, while PowerShell is built upon the .NETCLR (Common Language Runtime) and uses lightweight cmdlets to perform actions and typically return .NET objects.
PowerShell is an object-oriented scripting language and shell, and nearly everything in PowerShell is an object. Objects are made up of their object type, methods, and properties. Unlike strings, objects can be inspected, manipulated, and piped to other cmdlets while retaining their methods and properties.
While PowerShell scripts can get complex, the platform was designed from the ground up to be easy to understand and use. For example, the Verb-Noun naming convention makes it easy to identify the purpose of a cmdlet. Additionally, cmdlets such as Get-Help and Get-Member are also valuable resources when first learning PowerShell.
If you really want to hit the ground running with PowerShell, then one of the most helpful resources available is the book “Learn PowerShell in a Month of Lunches”. This book guides you through the most basic concepts of PowerShell all the way to conditional logic and debugging techniques. It’s filled with PowerShell tutorials designed to give you firsthand experience with the scripting language.
Lastly, and this tip is pretty obvious, use your preferred search engine to find online PowerShell resources. The PowerShell community is a very active group, and it encourages participation. Here are some online resources to check out:
PowerShell is one of the most powerful tools available to system administrators. From task automation to simplifying complex administrative jobs, there’s not much that PowerShell can’t do. Right now is the best time to start learning how to utilize PowerShell. PowerShell has already replaced Command Prompt as the default Windows shell. Now that PowerShell is cross-platform, it’s only going to get bigger as more of the tech community begins utilizing it. From its inception in 2003 to today, Microsoft remains heavily invested in PowerShell, and more importantly, the PowerShell community is propelling the platform forward.