Continuing my series of the features in PowerShell we shouldn’t forget – we get to PowerShell cmdlets.
The PowerShell cmdlet ecosystem has grown from the 137 cmdlets in PowerShell v1 to who knows how many are available to windows PowerShell v5.1, PowerShell v6.x and PowerShell v7 – certainly in the thousands.
A cmdlet is a small piece of code that does one job. The PowerShell concept is that cmdlets are linked into a pipeline to perform a particular task. PowerShell cmdlets emit .NET objects which are passed between cmdlets on the pipeline.
So far so good. More cmdlets available means more tasks can be performed with a single command. When I wrote PowerShell in Practice (v1/v2 times) there wasn’t such great cmdlet coverage so you had to resort to scripting. These days many, if not most, of things we had to write scripts for can now be done with cmdlets.
Cmdlets come from a number of sources:
– In the box with PowerShell
– Cmdlets provided by other Microsoft teams that ship in Windows
– Cmdlets provided by other Microsoft products
– Cmdlets provided by third party software vendors
– Cmdlets from public sources such as the PowerShell gallery
Some of the PowerShell v6/v7 is being provided through the gallery or being trialled in the gallery before, possibly, moving into the product.
So far so good.
On Windows we have a huge set of cmdlets such that I can say I’ve been using PowerShell since it was still Monad (much cooler name) and there are cmdlets I’ve not had reason to use.
This was true as of Windows PowerShell v5.1. PowerShell v6 was initially disappointing because it couldn’t utilise a significant set of the existing cmdlets suite. Porting of cmdlets to run under PowerShell v6 and the WindowsCompatibility module (a delicious irony that Windows needs a compatibility module to enable the use of functionality developed for Windows) whose functionality has since moved into Windows v7 have done much to address the issue. The vast majority of the functionality available under Windows PowerShell v5.1 is now available under PowerShell v7 though gaps still exist.
On Linux and mac the picture isn’t so rosy. There are the cmdlets that are available in the PowerShell v6/v7 install and as far as I’m aware that’s about it. Roughly back to where we were with PowerShell v1/v2. With Windows PowerShell we had the capability of falling back to CIM (WMI), COM or .NET to get things done. CIM and COM aren’t available on non-Windows and PowerShell v6/v7 are built on .NET core which introduces some limitations. To me if PowerShell is to be a true cross-platform administration tool I need to be able to issue the same command – irrespective of platform – and get the job done. Until we get cmdlets to work with storage, network adapters, IP addresses etc etc etc we’re not really in a cross-platform scenario.
Cmdlets are good. More cmdlets are better. Cross-platform cmdlets would be ideal.