header image

PowerShell v6: #1 major differences

Posted by: | October 24, 2017 Comments Off on PowerShell v6: #1 major differences |

In August 2016 PowerShell went open source. Since then we’ve seen 18 releases of alpha code and 8 beta release with another beta release imminent. This post – https://blogs.msdn.microsoft.com/powershell/2017/07/14/powershell-6-0-roadmap-coreclr-backwards-compatibility-and-more/ – from the PowerShell Team suggested a full release of PowerShell v6 before the end of 2017.


I’ve not written much about PowerShell v6 so far as its been rapidly changing but we’re beginning to see where PowerShell v6 is going. In this and a series of posts I’ll show you what’s different in PowerShell v6 – some good and some bad – what the important changes are and what impact that might have on your administration strategies.


The current version of Windows PowerShell – in Windows 10 and Server 2016 or WMF download is 5.1. As the above blog post states PowerShell 5.1 requires the FULL .NET Framework – currently 4.x – and will NOT receive major feature updates or low priority bug fixes (I read that as only security related bug fixes are likely).


PowerShell v6 is a fork of the v5.1 code but is based on .NET Core and will address bugs in the original 5.1 code, which won’t be ported back to PowerShell 5.1. PowerShell 6 uses .NET Standard 2.0 to provide binary compatibility with existing .NET assemblies which means that some but not all existing PowerShell modules will work under PowerShell v6.


PowerShell v6 isn’t an upgrade for PowerShell 5.1. It installs side-by-side meaning you can have multiple versions of PowerShell on the same machine.


Windows PowerShell (v1 – v5.1) is the Windows only version that shipped as part of the OS. PowerShell core (v6) is cross-platform with releases for Windows, Linux, macOS and docker – https://github.com/PowerShell/PowerShell


The major differences between PowerShell v6 and the Windows PowerShell you’ve come to know and love are detailed on the v6 release notes – https://github.com/PowerShell/PowerShell/releases.  In summary these include:

Allow * to be used in registry paths – breaking change
Remove -ShowWindow from Get-Help – breaking change
Fix incorrect position of a parameter which resulted in the args passed as input instead of as args for InvokeScript()  – breaking change
Enable transcription of native commands on non-Windows platforms
Add Remove-Service cmdlet
Added functionality to set credentials on Set-Service
Get-Date now supports more argument completion scenarios
Exclude -ComObject parameter of New-Object on unsupported (currently non-Windows)
Remove Workflows
Get-Content -Delimiter to not include the delimiter in the array elements returned
Add support for converting enums to string
Support SSH for remoting as well as WSMAN
Remove WMI cmdlets – CIM cmdlets are still available
Remove the *-Counter cmdlets
Move-Item cmdlet honors -Include, -Exclude, and -Filter parameters
Change positional parameter for powershell.exe from -Command to -File  – breaking change
Make change across PowerShell to support case sensitivity on *nix
Putting & at the end of a pipeline will cause the pipeline to be run as a PowerShell job.
Add -Extension and -LeafBase switches to Split-Path so that you can split paths between the filename extension and the rest of the filename
Fix Get-Help to not return multiple instances of the same help file


Plus a whole load of smaller changes to enable PowerShell to work on Linux and macOS


These changes are in the pipeline
Rename powershell.exe to pwsh.exe – Linux admins don’t like typing more than 4 characters at a time evidently
Standarize encoding for cmdlets that write to files
Remove the -ComputerName parameter from many cmdlets e.g. *-Service & *-Process so that individual cmdlet based remoting (over DCOM) isn’t available. All remoting goes through SSH or WSMAN


There are also a few issues to consider:

Case sensitivity – Windows is case-insensitive but Linux and macOS are case sensitive. You need to use the correct casing on Linux and mac
File path delimiters – non-Windows must use /
File extensions – not usually used on non-Windows but are required by PowerShell e.g. .ps1 and .psm1
Aliases that match linux commands – ls, cp, mv etc – are removed on Linux and macOS
JEA isn’t supported on non-Windows
Snapins aren’t available on v6 so some functionality e.g. Active Directory cmdlets can’t be used


PowerShell v6 is a major change – probably best regarded as a breaking change. I’ll investigate some of these issues in more depth in subsequent posts


This is a useful list of packages and resources irrespective of version- https://github.com/janikvonrotz/awesome-powershell

under: PowerShell v6

Comments are closed.