In this video, check out the latest changes in PowerShell version 6, including updates that allow PowerShell Core to run on Windows, MacOS, and Linux.
- [Instructor] PowerShell has been with us for quite a while now, and has gone through several generations of upgrades. We've seen the addition of features like remote sessions, resumable sessions, updatable help files, network diagnostics, and other features that have made it more powerful. And each one of these versions has been built on Microsoft's .NET framework, and was sent out as a component of Windows workstations and servers. While it's true that Microsoft has been writing applications for Mac since, well, since there's been a Mac, this scripting language and command shell has only existed on Windows machines, and that's largely because of that requirement of the .NET framework.
Recently, Microsoft has been building more and more bridges to the open-source community. One of these is the inclusion of Docker containers as a means of virtualizing application environments. Also, the inclusion of the Windows subsystem for Linux, which allows an administrator to run bash in their choice of Linux distros on a Windows server without having to virtualize anything. PowerShell 6.0 builds on this partnership by not just taking these other environments and bringing them into Windows, but taking a Windows component and porting it out.
Instead of being built on the Windows-only .NET framework, PowerShell 6.0 is build on .NET Core, a development platform that can be downloaded and installed not only on Windows, but Mac and Linux, and other operating systems as well. Along with porting .NET to this more open environment, a new version of PowerShell has been created, built on .NET Core. This more open edition of PowerShell is known as PowerShell Core, PowerShell version 6.0 is only available in this Core distribution.
There is no PowerShell 6.0 for Windows PowerShell, and it's almost like Microsoft rebuilt PowerShell from the ground up. PowerShell Core is not built into Windows 10 or Windows Server 2016, or even the earlier semi-annual builds of Windows Server. This change from the .NET framework has left a few things on the table though. Most management and administration modules made it into PowerShell Core, but some of the modules that were part of Windows and not necessarily part of everyday administration weren't ported over initially.
For example, DNS Client and Hyper-V modules were not included in earlier versions of PowerShell Core. Those Microsoft teams will be working those out over time, and those modules will become available, but for now, they're missing. However, to turn on our focus on the more notable additions, PowerShell Core has also added features that make it more friendly for Mac and Linux administrators and developers.
Command-line shells in various distributions of Linux differ from Microsoft's command interpreter and previous versions of PowerShell, and some of those differences that make it a little bit uncomfortable to shift back and forth are small things like case sensitivity and which slash is used in file paths. Also things like what types of wildcards work when searching for file names, or whether you're allowed to use commas and colons in object names.
PowerShell Core provides for all of these. PowerShell Core is case sensitive, but it will only recognize that difference when it's important and will ignore it when it's not. The forward slash and backslash are completely interchangeable within PowerShell. Technically, you could alternate back and forth between them in a long expression and it will work. And just about all the characters that are supported in a Linux path will work within PowerShell Core.
This new tolerance at the PowerShell prompt may feel like a small addition, but the change from the .NET framework to the broader .NET Core is a big deal. Because of this change, PowerShell Core is an entirely separate installation from Windows PowerShell. You can run Windows PowerShell and PowerShell Core side by side on a Windows 10 or Windows Server machine, and I recommend you do this while experimenting with PowerShell Core.
Take your scripts that you've written in Windows PowerShell, including those that have worked for years, and test them in PowerShell Core to make sure that the commandlets and functions that you've become accustomed to are available and work the way you expect them to. Many are reporting that Windows PowerShell is on its way out so it will be important to know that your scripts and administration habits carry forward. And we're going to encounter some of these differences as this course continues.
- Getting started with PowerShell
- Using PowerShell cmdlet syntax
- Creating functions
- Working with PowerShell profiles
- Extending PowerShell with modules
- Managing pipeline output
- Creating PowerShell scripts in ISE