Microsoft's PowerShell for Linux
.NET Core: Slimmed-Down .NET
In PowerShell's documentation for Linux and Mac OS, the Microsoft developers point out that Windows admins on Linux will not find all of the usual PowerShell commands. PowerShell for Linux is not based directly on the large .NET framework, but on a slimmed-down version called .NET Core. For example, the PowerShell functions referring to the Windows interface do not exist on Linux systems or Mac OS computers. Similarly, several cmdlets that Windows admins will be familiar with from their usual environment are absent from PowerShell for Linux.
The slimmed-down .NET version is also important in another respect: If you find cmdlets or scripts for PowerShell on the Internet, you can generally expect the Windows PowerShell to run the script correctly. Ultimately, cmdlets are simply .NET classes that include other, commonly available .NET classes. If a class referenced in the script is missing from the .NET Core collection, it won't run in PowerShell for Linux.
OMI – The Rebirth of WMI
Another component that PowerShell relies on in the background, and that is lacking on Linux systems, is Windows Management Instrumentation (WMI). WMI performs important computer-management tasks on Windows systems. Windows hosts can be automatically administrated via WMI, for instance, by rolling out the code on the target system.
WMI is Microsoft's method for realizing the principle of Web-Based Enterprise Management (WBEM) and implementing an interface for the Common Information Model (CIM) according to DMTF standards. PowerShell's open source properties cease when it comes to the topic of WMI. The PowerShell extensions related to WMI are not in the open source part of PowerShell and therefore don't work in the Linux version.
Microsoft is promising to offer a solution for the lack of WMI support; the company currently refers users to DSC for Linux , which has been available for quite a while now. The idea behind DSC is to compensate for the lack of WMI functionality with OMI. OMI, the Open Management Infrastructure, is an alternative to WMI by the Open Group, and it is available online as a free download. DSC lets PowerShell execute tasks on Linux similar to those performed on Windows via WMI.
DSC: Desired State Configuration
The component within PowerShell that prepares other computers using a preset configuration is called Desired State Configuration (DSC). Microsoft had already released a limited version of DSC for Linux in 2015. Like Puppet, DSC implements declaratively-formulated settings alongside the admin instructions on the host. Another similarity with Puppet is that DSC is idempotent, meaning that it delivers the same result with multiple runs as with one simple run.
An interesting fact about DSC is that it also works similarly to Puppet under the hood. You supply the desired configuration in the form of a config document (MOF file), then transfer it from its PowerShell environment to the Linux machine via a push command. The PowerShell documentation on DSC demonstrates a solid example for creating a file in /tmp
on the target host.
However, that naturally has little to do with the practical reality. While WMI is adjusted for the system on Windows hosts, the OMI-based approach currently remains more or less useless in its effect for Linux and Mac OS. It remains to be seen whether Microsoft is looking to develop DSC for Linux into a proper management tool, or whether in the end the field will be left to established solutions such as Puppet.
As previously mentioned, DSC for Linux was originally a low-priority effort from Microsoft, with the company implementing the necessary PowerShell commands as Python scripts. With the publication of PowerShell for Linux, they have avoided such a necessity. For the foreseeable future, Microsoft is likely to continue to offer DSC on Linux from the real PowerShell.
With the exception of DSC, little is going on with PowerShell in its first version for Linux. WinRM functionality is not present, which means it is not possible to use PowerShell to send a computer remote commands – a PowerShell equivalent to SSH functionality is simply not available for Linux. Microsoft has at least recognized this problem and has promised to address it. However, it is impossible to predict how the implementation will look in practice. Microsoft is presumably relying on established protocols such as OpenSSH for the solution. Altogether, PowerShell is likely to develop in the future into a universal tool aimed at Windows and Linux systems equally.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.
-
DebConf24 to be Held in South Korea
Busan will be the location of the latest DebConf running July 28 through August 4
-
Fedora Unleashes Atomic Desktops
Fedora has combined its solid distribution with rpm-ostree system to make it possible to deliver a new family of Fedora spins, called Fedora Atomic Desktops.
-
Bootloader Vulnerability Affects Nearly All Linux Distributions
The developers of shim have released a version to fix numerous security flaws, including one that could enable remote control execution of malicious code under certain circumstances.