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 tasks both simple and complex. The newest versions of PowerShell offer cross-platform support, running on Microsoft Windows, Linux, and macOS.
A brief history of PowerShell
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 Windows Command Prompt (cmd.exe), offered limited functionality and control of the Windows graphical user interface (GUI).
The company considered porting existing UNIX tools to work on Windows OS, but it eventually scrapped these efforts 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 Monad’s architecture, advancements, and value.
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.
What is PowerShell used for?
PowerShell can be used for a wide array of common IT tasks, so 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. The right PowerShell command 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
Automating repetitive tasks
Configuration management
Manipulating files and folders
Web scraping
Formatting data
Interacting with APIs
Database queries
Systems management
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 skill set.
Who uses PowerShell?
Professionals passionate about system administration and automation frequently become PowerShell users.
PowerShell is heavily integrated into all currently supported versions of Windows desktop and Windows Server operating systems. It’s also freely available to macOS and Linux users. All this means that 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.
Why should you use PowerShell?
You should use PowerShell because it 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.
Now is the best time to start learning how to utilize PowerShell. PowerShell has already replaced Command Prompt as the default Windows shell. And 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.
How can you learn PowerShell?
While PowerShell scripting 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, learning the top 10 cmdlets is a valuable way to get your feet wet. Then, you can dive in to writing your first PowerShell script.
If you really want to hit the ground running with PowerShell, then one of the most helpful resources available is 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 documentation. The PowerShell community is a very active group, and it encourages participation. Here are some online resources to check out:
What are the different types of PowerShell consoles?
There are several types of PowerShell console, including PowerShell CLI, Windows PowerShell Integrated Scripting Environment, VS Code, and Windows Terminal. Choosing the right PowerShell console largely depends on what you’re trying to accomplish. Are you writing a full PowerShell script file or just running a few commands?
Here are more details on 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 system 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. However, it continues to receive security and high-priority servicing fixes. Additionally, Windows PowerShell ISE only supports versions up to PowerShell 5.1 and does not support newer versions, like PowerShell 7.
VS Code: Visual Studio Code, commonly referred to as VS Code, is a free, lightweight code editor developed by Microsoft. It supports a wide variety of popular programming languages, including Python, C++, PHP, Ruby, JavaScript, PowerShell, and many more. Through installable extensions, VS Code offers a great feature set, including IntelliSense, script debugging, and syntax highlighting. It also supports PowerShell versions 3 to 5.1 and all versions of PowerShell Core. VS Code is highly customizable by installing Microsoft and community-developed extensions.
Windows Terminal: Windows Terminal is a dedicated console for all your favorite command-line shells. 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.
What are PowerShell commands?
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. Each PowerShell module is a self-contained package that might include cmdlets, functions, workflows, variables and more.
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.
What’s the difference between PowerShell and CMD?
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.
What is the difference between PowerShell and Windows PowerShell?
PowerShell and Windows PowerShell are different versions of Microsoft's automation language.
PowerShell, sometimes referred to as Microsoft PowerShell or PowerShell Core, is a cross-platform scripting language built on newer versions of .NET. Windows PowerShell is the original version of PowerShell, which focuses on Windows environments and uses the .NET Framework.
What is Azure PowerShell?
Azure PowerShell refers to modules built for managing resources in Microsoft Azure. Microsoft recommends using PowerShell 7 or higher with these modules.