Everything MSPs Need to Know About PowerShell Core 6.0

Table of contents

PowerShell Core 6.0 is the new “edition” of PowerShell that was released at the beginning of the year. The biggest and most important change with this new rendition is that it is multi-platform. PowerShell Core 6.0 uses .Net Core 2.0 as its runtime instead of .Net Framework, allowing PowerShell Core to run on multiple platforms like Linux and even macOS. Why is this a big deal for MSPs? This change sparks the beginning of allowing MSPs to create scripts that will be multi-platform compatible which in turn provides greater control and automation over customer environments. One scripting language to rule them all!

Windows PowerShell vs PowerShell Core

Most IT Pros know what Windows PowerShell is, however, they need to know the differences between Windows PowerShell and PowerShell Core. They are not that same. PowerShell Core is a new version of PowerShell that is built on .NET Core instead of .Net Framework, which is what Windows PowerShell has been using for the past 10+ years. Because PowerShell Core is built on .Net Core, it allows the cross-platform compatibility that we are now seeing today.

Because PowerShell Core does not run on .Net Framework, there are some features that were not ported over to the new PowerShell Core. Features like Workflows, Snap-ins, and WMI 1.0 cmdlets are not available. Microsoft’s goal is to make PowerShell Core as backward compatible with Windows PowerShell as possible, they have ensured that most of the built-in modules work the same.

Powershell.exe has also been renamed to pwsh.exe. Microsoft has done this in an effort to support running Windows PowerShell and PowerShell Core side-by-side.

Also, it’s important to note, that Windows PowerShell 5.1 is the last version of Windows PowerShell that Microsoft will be releasing. They will now be focused on PowerShell Core which starts at version 6.0.

Getting Started with PowerShell Core

Because Windows PowerShell 5.1 is the last version of the old Windows PowerShell, it is important to get familiar with PowerShell Core and start designing your PowerShell scripts with PowerShell Core in mind if possible. It is much easier to start now, then go back and make changes to the numerous scripts you’ve made over the year, to make them compatible with Core. Plus, you’re doing yourself a favor since any script that you make that runs in Core will now be multi-platform compatible!

PowerShell Core can be installed side-by-side with Windows PowerShell. You can download PowerShell Core for Windows , and for Linux/macOS .

In Windows, PowerShell Core runs in its own black console:

There is currently no PowerShell ISE support with Core, in fact, Microsoft is recommending using Visual Studio now to edit/build your PowerShell scripts. So, download Visual Studio Code for free here. After installing Visual Studio Code, open the application and add the PowerShell extension by clicking the Extensions icon and search for “PowerShell”. Select Install:

Click reload:

Now when you want to switch over to PowerShell 6.0, simply right click in the corner on 5.1 and select the option at the top to switch to 6.0:

Now you can see in the lower right-hand corner that you are now using PowerShell 6.0:

If you want to learn more about PowerShell development in Visual Studio Code, be sure to check out David Wilson’s presentation here.

Also, if you want to play around with remotely managing devices with PowerShell Core you will need to download OpenSSH. With being a multi-platform language, PowerShell Core uses SSH to perform remote management as opposed to the old way of using winRM. As a result, Enter-PSSession and New-PSSession can now be used to connect and authenticate via SSH.

Migrating Scripts Over to PowerShell Core

PowerShell Core is still in its infancy. Certain cmdlets in the old version are not yet available in 6.0. For example, Active Directory cmdlets are not yet ported over to PowerShell Core. Fear not though, Microsoft is currently working on getting more and more of these features back in PowerShell Core. Also, Get-WMIObject cmdlets are no longer available, this was done on purpose in order to make remote management more “universal”.  Instead use Get-CIM, which has been Microsoft’s preferred method in the later versions of Windows PowerShell.

For migrating a script over to PowerShell Core, you will need to test run your script through pwsh.exe and verify whether any cmdlets are missing. If your script is missing specific cmdlets like the Active Directory modules, then you’ll most likely have to wait until that functionality is available before it can successfully run in PowerShell Core.

Microsoft’s decision to switch over to PowerShell Core is overall for the better, especially for MSPs. This opens the gates for more automation and management of client devices and servers. And with one universal language for multiple platforms, MSPs will also be able to use fewer tools to perform their automated tasks for their clients.  This also increases the value of employees that can develop in PowerShell because they can now use their PowerShell magic abilities against non-Windows systems. Let me know in the comments bellows on some of the ways that this could be helpful to your environment.

Altaro O365 Backup for MSPs
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

Leave a comment

Your email address will not be published. Required fields are marked *