Microsoft announced the general availability of PowerShell Core 6.0 on January 10th. In this Ask the Admin, I’ll look at the roadmap for PowerShell and some of the dramatic changes since Microsoft announced that PowerShell will be open source.
40 percent of all VMs provisioned in Azure run Linux. And 26 percent of VMs in Amazon Web Services (AWS) run Windows. If you take Azure and AWS as the two biggest providers, that’s not a small number of Windows servers running in the cloud, although Linux has a clear lead. The reality for many organizations is that they manage a mixture of Windows and Linux servers, whether in an on-premises datacenter, in the cloud, or both.
But Windows and Linux are conceptually different operating systems and there are different management tools and systems to reflect that reality. Bash, Puppet, and Python are common tools used for managing Linux environments. While those tools can be run in Windows, they are not native to the platform. Although if you install Ubuntu, openSUSE, SLES, or Fedora using the Windows Subsystem for Linux (WSL), you get access to a limited Bash shell.
Windows isn’t called Windows for no reason and system administrators generally avoid the command line. But in 2006 Microsoft introduced PowerShell, a new task automation and configuration management framework that was designed to give Windows administrators a powerful set of command line tools like those available for Unix. The key difference between Bash and PowerShell is that where Bash returns data as a text string, PowerShell is objected-orientated and pipes objects containing structured data. Windows also has PowerShell Desired State Configuration (DSC), which like Puppet, uses a declarative syntax to determine how servers should be configured and not a series of configuration steps. But unlike Puppet, DSC is based on PowerShell and not Ruby.
Windows PowerShell is based on the .NET Framework. But what makes PowerShell Core possible on Mac OSX and Linux is .NET Core, a scaled down and open source version of the .NET Framework for Windows and Linux.
Microsoft’s aim is to make PowerShell Core as functionally close to Windows PowerShell as is technically possible. But PowerShell Core is missing WIM and COM support, and some other Windows-specific things. And naturally it’s unlikely that you’re going to simply copy PowerShell scripts used to manage Windows to manage Linux because Windows is configured using a set of APIs, but Linux is managed by manipulating text files. So, PowerShell scripts used for managing Linux would look different.
PowerShell on Linux-based OSes is not intended to be a replacement for Bash but an additional tool that allows DevOps to manage Windows Server, Azure, VMware, Hyper-V, and other software-defined systems using PowerShell in Linux and Mac OSX without needing to switch to Windows.
PowerShell Core 6.0 comes with a limited number of supported first-party modules, i.e. those supplied and supported by Microsoft, which you can see below. While the list looks quite restricting, because PowerShell core is based on the .NET Standard 2.0 and CDXML, many Windows PowerShell modules are compatible with PowerShell Core. And Microsoft’s product teams are working to port its Windows PowerShell modules to PowerShell Core.
To use Windows PowerShell modules in PowerShell Core on Windows, run the cmdlets shown below in PowerShell Core to install the WindowsPSModulePath module and add the Windows PowerShell PSModulePath to your PowerShell Core PSModulePath.
Install-Module WindowsPSModulePath -Force -Scope CurrentUser Add-WindowsPSModulePath
Another feature of PowerShell Core is that it can be installed side-by-side with Windows PowerShell. And that’s important because PowerShell Core isn’t designed to replace Windows PowerShell on Windows, at least not yet. Different versions of PowerShell Core can also be installed side-by-side. PowerShell ISE is being retired with PowerShell Core 6.0. Microsoft recommends using Visual Studio Code with the PowerShell extension instead.
Microsoft isn’t retiring Windows PowerShell. At least, not yet. But developing and maintaining two separate versions of PowerShell doesn’t make much sense for Microsoft. PowerShell Core will receive new features and Microsoft aims to add as much from Windows PowerShell to Core as technically possible. Windows PowerShell will be supported and receive bug fixes.
In the coming months on Petri, we’ll be looking more closely at PowerShell Core 6.0 and how it works in practice. But if you can’t wait, for more information about PowerShell Core 6.0 and how to get it, see Microsoft’s announcement on MSDN here.