Let’s start this new year by introducing the new version of PowerShell which is called “PowerShell Core”. Yes, PowerShell Core 6.0 is Generally Available!
What does it mean?
In January, Microsoft has introduced the new version of PowerShell. This new version of PowerShell is a cross-platform tool that is available for Windows, Linux and MAC OS operating systems. The biggest change with PowerShell Core 6.0 is that it was developed on the open source .NET Core platform while Windows PowerShell was developed on the .NET Framework.
Why moving from .NET Framework to .NET Core?
Because you will be able to run your scripts on any platform you want: Windows, Linux and MAC OS. For instance, the developers team can create their PowerShell scripts on Linux, and the Operations team can run the scripts on Windows.
One thing to notice is that you can install and configure PowerShell Core separately from Windows PowerShell. Both versions can exist on the same operating system.
Another thing to note is the new executable name. The pwsh.exe process is the new name for PowerShell Core starting with version 6.0. The executable changed names from powershell.exe to pwsh.exe.
PowerShell Core is officially supported on the following platforms:
- Windows 7, 8.1, and 10
- Windows Server 2008 R2, 2012 R2, 2016
- Windows Server Semi-Annual Channel
- Ubuntu 14.04, 16.04, and 17.04
- Debian 8.7+, and 9
- CentOS 7
- Red Hat Enterprise Linux 7
- OpenSUSE 42.2
- Fedora 25, 26
- macOS 10.12+
You will probably think that PowerShell Core is limited, and you are right. The Microsoft PowerShell Core Team said:
“From a functional perspective, Windows PowerShell is still more powerful, in that it can take advantage of a bigger and more set of .NET capabilities that are exposed by the .NET Framework and .NET Standard. PowerShell Core relies on the newer, cleaner, but less capable .NET Core runtime, which limits its functionality to what’s available today in .NET Core and .NET Standard. But the advantage to PowerShell Core—like .NET Core—is that it’s cross-platform compatible. So any scripts that you write for PowerShell Core will work across Windows, macOS, and various newer Linux distributions, like Ubuntu, Debian, Red Hat Enterprise, and others.”
The PowerShell Core Team also explained that many PowerShell features are missing in PowerShell Core:
“As part of the move to .NET Core and other operating systems, we were forced to leave behind some technologies that were being used by Windows PowerShell. In other cases, we took the opportunity of PowerShell being refactored to stop supporting lesser used technologies. Some of these technologies may eventually return to PowerShell Core, but many will not.”
Below you can see the PowerShell Core roadmap from the Microsoft website:
PowerShell Core is adopting the Microsoft Modern Lifecycle Policy, so it means that you must update within six months after each new minor version release. So Microsoft explained:
For example, if PowerShell Core 6.1 is released on July 1st, 2018, you would be expected to update to PowerShell Core 6.1 by January 1st, 2019 to maintain support.
Installing PowerShell Core 6.0
First, go to: https://github.com/PowerShell/PowerShell in order to download the MSI Package if you work on Windows. Note that you don’t need a GitHub account.
Find your operating system and select the corresponding platform:
If you want to install it on MAC OS or Linux, please read the following blog post to learn more about this task: https://www.bdrsuite.com/blog/installing-powershell-ubuntu-mac-overview/
In my case, I selected Windows (x64). So run the MSI Package, and follow the wizard. One thing you will immediately notice is the new logo which is so cool!
Click “Next”
Accept the license agreement
Note the destination folder which is by default located in “C:\Program Files”.
Click “Install” and wait for a few seconds
Click “Finish”. Now if you want to open the new PowerShell Core console, you can navigate to your programs or to the “Program Files” folder:
The PS Core console is pretty much the same as the Windows PowerShell console, except the background color.
One of the cool thing is the ability to run both version of PowerShell on your machine. I mean that you can run PowerShell Core, and also open another Windows PowerShell 5.1 console. Let’s run the following command and notice the PSVersion:
Now, I can easily differentiate both version of PowerShell in my taskbar (e.g PS Core and Windows PowerShell).
When you open the Task Manager, you will notice a new PowerShell EXE:
- Pwsh.exe: PowerShell Core 6
- Windows PowerShell: Windows PowerShell 5.1 (in my case)
If I open a cmd console, I can open both PowerShell version by typing “Pwsh.exe” (PS Core 6) or “PowerShell” (Windows PowerShell 5.1):
If you are wondering why “pwsh.exe”, I advise you to read the full story on GitHub: https://github.com/PowerShell/PowerShell/issues/4214
What about my PowerShell Modules?
A fresh install of PowerShell 6.0 will not have any of your modules loaded. This is because all the module install locations have changed.
Let’s take a look at the modules location:
By installing the WindowsPSModulePath module, you can append the Windows PowerShell PSModulePath to your PowerShell Core PSModulePath. Run the console as administrator:
If you are used to install PowerShell Modules from the PowerShell Gallery, you must be careful because all PowerShell modules are not compatible. In order to identify which PowerShell modules are compatible with PS Core, you must append the “PSEdition_Core” tag:
Or just open the following link:
https://www.powershellgallery.com/items?q=Tags%3A%22PSEdition_Core%22
Useful links
Below are some useful links to keep informed about PowerShell Core 6.0:
- The announcement of PowerShell Core 6.0:
https://blogs.msdn.microsoft.com/powershell/2018/01/10/powershell-core-6-0-generally-available-ga-and-supported/ - PowerShell Core on GitHub:
https://github.com/PowerShell/Powershell - What’s new in PowerShell:
https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-5.1
Conclusion
Finally, PowerShell Core 6.0 does not have an integrated scripting environment such as ISE. So the Microsoft PowerShell Team recommend to use Visual Studio Code.
Here, we start working with the very first version of PowerShell Core 6, so there are key cmdlets missing in PS 6.0 Core. During this year, you must use Windows PowerShell along with PowerShell Core 6. But, we must congratulate The PowerShell Team because they have performed an amazing job regarding the potential of PowerShell Core.
So stay informed and keep updating your PowerShell Core version.
Experience modern data protection with this latest Vembu BDR Suite v.3.9.0 FREE edition. Try the 30 days free trial here: https://www.bdrsuite.com/vembu-bdr-suite-download/
Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.