What is PowerShell 7?
PowerShell is a scripting language and an alternative to the command-line interface. PowerShell is an automation tool consisting of (at least) three parts:
- A shell, like the Command Prompt in Windows or the Terminal in Linux or macOS
- A scripting language
- A configuration management framework called Desired State Configuration (DSC)
In practice, when we talk about PowerShell, we’re usually talking about the scripting language. Usage of the shell is largely intuitive to the user, as we’ll see, and while we’ll talk about DSC later, in my experience, most people don’t use it as much as they should.
The first version of PowerShell grew out of a project called Monad, which was an attempt by Jeffrey Snover to replicate Unix tools on Windows. He realized that one of the fundamental drawbacks of Unix tools is that they output a bytestream (usually text), and so a lot of effort is wasted on searching, formatting, and extracting the output of commands before you can act on that output. Monad was written to output objects that could be input straight into another command. We’ll cover this in more detail when we get to Chapter 4, PowerShell Variables and Data Structures. PowerShell 1.0 was released in 2006, but in my opinion, it didn’t really take off until PowerShell 2.0 was released in 2009, and Microsoft started re-engineering the administrative interfaces of major pieces of software such as Exchange Server 2010 to make use of it. Other opinions are available.
At the time of writing, there are two main flavors of PowerShell: Windows PowerShell, which comes bundled with both server and desktop versions of Windows, and PowerShell 7, which must be downloaded and installed. The latest (and allegedly final) version of Windows PowerShell, v5.1, is built on .NET Framework 4.5, the proprietary software framework that is bundled with Windows and underpins many of Microsoft’s products. PowerShell 7.0 was built on .NET Core 3.1, a simplified, open source implementation of .NET. However, since version 7.2, PowerShell has been built on .NET 6.0. This unified version of .NET is a replacement for both .NET Framework and .NET Core, and was released in November 2020.
Because of the fundamental differences between Windows PowerShell 5.1 and PowerShell 7.x, there can be some differences in how they work on the Windows platform. These will be discussed in Chapter 13, Working With PowerShell 7 and Windows.
We’ll find it useful to summarize some of the key differences in the following table:
Parameters |
Windows PowerShell |
PowerShell 7.2 |
Platform |
x64, x86 only |
x64, x86, arm32, arm64 |
OS |
Windows |
Windows, Linux, macOS |
.NET Version |
.NET Framework 4.5 |
.NET 6.0 |
License Type |
Proprietary |
Open source |
No. of Native Commands |
1588 (in vanilla Windows 10) |
1574 (in vanilla Windows 10) 290 (in Ubuntu 20.04) |
Table 1.1 – Some differences between Windows PowerShell and PowerShell 7
In this section, we have covered what PowerShell is, and how it differs from Windows PowerShell. In the next section, we’ll look at why PowerShell 7 exists and see what makes it special.