PowerShell Core

Author by Mitchell Grande

PowerShell 5.1 is the latest release of the original PowerShell.  Starting with version 6.0, PowerShell is now referred to as PowerShell Core.  PowerShell Core 6.0 is cross-platform - supported on macOS, Linux, and Windows - and built on .NET Core instead of the traditional .NET framework.

PowerShell Core Overview

PowerShell Core 6.0 is a separate installation of PowerShell that can run side-by-side with the original PowerShell version on a given machine.  This allows users to use PS Core without negatively affecting their existing PowerShell scripts and functionality.

PowerShell Core has the same syntax and overall functionality as the original PowerShell.  Most of the common native commands and features work exactly the same way in PowerShell and PowerShell Core.  There are a few exceptions which are noted later in the Breaking Changes section.  Additionally, many of the non-native modules, such as the Active Directory module, are not currently compatible with PS Core.  Other modules may work but aren't officially supported.

Traditional PowerShell won't be going away in the near future.  Instead, it is expected that PowerShell 5.1 and the latest version of PowerShell Core will both ship in future versions of Windows Server.  This would allow scripts that use modules that are incompatible with PS core to use the original version of PowerShell.  However, PowerShell itself won't be receiving any major new features.  Future development work is focused on PowerShell Core, with PowerShell mostly getting fixes.

Advantages of PowerShell Core

With the release of PowerShell Core 6.0, Microsoft has taken another step towards focusing on mixed-OS environments.  With PS Core supporting all major OSes, engineers can use the same language on nearly any server in their environment.  Instead of writing PowerShell scripts for Windows and separate bash or Python scripts for Linux, PowerShell Core can be used to support both.

PowerShell Core 6 also has improved performance both in startup and command execution time.

Breaking Changes

There are some relatively common cmdlets that are not supported in PS Core.  Some of those are:

  • WMI commands, like Get-WmiObject or Invoke-WmiMethod
    • Instead, use the related CIM commands like Get-CimInstance
  • *-Computer commands, like Add-Computer which joins a computer to a domain
  • Get-EventLog to retrieve Windows events
    • Instead, use Get-WinEvent

In addition to these specific commands that aren't supported, some common modules are incompatible with PS Core.  For example, the ActiveDirectory and DnsClient modules do not work with PS Core.  Most likely, they will eventually be updated to work with PowerShell Core, but that isn't totally clear.

Getting Started

To install PowerShell Core on Windows, first visit https://github.com/PowerShell/PowerShell/releases.  This page has the various releases of PowerShell Core listed.  Within each version, there's an Assets section that contains links to the downloadable installers.  Look for the win-x64 file, download, and install it.  Once installed, start up PowerShell Core with the pwsh command or by finding it in the start menu:

pscore-1.png

For macOS or Linux, review the steps in the documentation.

Once it's opened, go ahead and run your commands just like normal:

pscore-2.png

For more information, read the official documentation.  Also, the future of PowerShell is discussed on the Microsoft Dev Blog.

Author

Mitchell Grande

Systems Engineer

Tags in this Article