Wednesday, May 3, 2017

Not all of PowerShell works on Linux

As great as it is that PowerShell has a Linux version, not all features are there quite yet. There are two major classes of things that are only supported on Windows:

  • Types provided by unmanaged libraries, especially COM. The ParsedHtml property on the objects returned by Invoke-WebRequest, for example, is of a COM class provided by mshtml.dll - an Internet Explorer component. Since that functionality has not been ported, that property is null on other platforms.
  • Cmdlets to manage Windows-only systems. Linux doesn't have the Windows concept of Modern apps, so all the Appx-related cmdlets aren't there. Similarly, Linux PowerShell is missing cmdlets for Hyper-V, Windows Firewall, and so on.
Though lots of things do work perfectly fine on any platform, it's advisable to test a script on at least one non-Windows OS. I find Bash on Ubuntu on Windows a convenient way of doing that - installing PowerShell in there is just the same as on a real Ubuntu machine.

No comments:

Post a Comment