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.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Bash vs. Vista PowerShell

    Microsoft’s new PowerShell relies on .NET framework libraries and thus has access to a treasure trove of functions and objects. How does PowerShell measure up to traditional shells like Bash?

  • PowerShell for AD

    Professionally manage Active Directory users, groups, and other AD objects with Windows PowerShell Version 2.0.

  • Tech Tools
    • NVidia gaming device
    • Qt 5.0 Released
    • Oracle NoSQL DB 2.0
    • SuperSpeed USB 3.0
  • Linux Turns 25

    Linux has evolved from “won’t be a professional” project to one of the most professional software projects in the history of computers.

  • NEWS

    In the news: Linux Usage Is on the Rise; Lenovo Is Jumping on the Linux Laptop Bandwagon; A New Linux Laptop Is in the Making; Ubuntu 20.04 Released; and Git 2.26 Released.

comments powered by Disqus
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