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.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.