Microsoft Open Sources PowerShell And It Runs On Linux
Written by Mike James   
Monday, 22 August 2016

PowerShell is a strange beast that has now been let loose on Linux as well as Mac. You could even say "on the world" as it is now open source. What is PowerShell and why should you care?

powershell1

Windows didn't have a shell command language that made it easy to do things to the system. The best it had was a batch language that basically provided a way to run command line instructions plus a few other extras. Compared to Linux it was very poor. Then a number of scripting languages sprang up, JScript and VBScript, and things were a little better, but still not good. The biggest problem was that there was never a utility that did what you wanted it to that could be used within a script. After all script languages are the glue between utilities and without utilities the glue is pointless. You could, however, do some clever things. 

Then along came PowerShell. This is a .NET based scripting language and environment that made it possible to so so much more. The big problem was the same old story - there were never the utilities or cmdlets that you needed to do complex things. A second problem with PowerShell is that its based on .NET and fully object-oriented with C# as the glue language.

While the benefits of object orientation are obvious when you are writing bigger programs, and in good development environments, it has never been clear that objects are a good thing to have in a scripting language. PowerShell wasn't just the take it or leave it object orientation that you find in scripting languages like VBScript, it is aggressively object-oriented. You create complex procedures not by piping the text output of one simple command to another but by piping objects, complete with properties and methods. 

Many programmers regard PowerShell as just too powerful for the job. 

Now Linux and Mac programmers can find out if it really is any good. Microsoft has open sourced PowerShell and, as .NET Core is now available under Linux and Mac, so is PowerShell. You can get an alpha and try it out now. 

So why bother?

Microsoft explains part of the motivation by the fact that one in three Azure machines is Linux-based and having a single tool to mange all operating systems would be a good thing. This ignores the fact that the way that the systems are managed is very different. How can PowerShell work with systemd (to mention another can of worms) and WMF (Windows Management Framework)? If you dash off a quick "script" in PowerShell that does something on Windows, what are the chances it is going to work under Linux? Not very high. Already we have a pull request from the author of Curl to remove the half-implemented PowerShell aliases for wget and curl. This not only indicates the resentment toward Microsoft for moving into Linux territory but highlights the half done job of making PowerShell a Linux tool. 

Of course, if you are a PowerShell fan then the fact you can use it on Linux is great. In time there might even be crossplatform management systems and other similar tools, but these are hardly low level scripting tools. 

What makes the whole situation even stranger is that Microsoft recently implemented the Bash shell as part of the Windows Linux subsystem. So now you can write Bash shell scripts under Windows. Admittedly you can't gain much access to Windows from the Linux Subsystem, but in time you might. 

There have been some additions to PowerShell as well as just opening it up to Linux. You can now choose to use VS Code or Sublime as your editor with the help of the PowerShell Editor Service. The PowerShell remoting protocol now uses OpenSSH as its native transport. 

 

Here is Microsoft's promotion video for the new PowerShell:

 

There doesn't seem to be anything sinister in the availability of PowerShell despite the worries of many a Linux supporter. The idea that Microsoft is somehow moving into Linux territory to damage it in some way doesn't make a lot of sense, given the support that Azure has for Linux. More likely Microsoft will make a lot of money from its Linux support; so much so that it probably doesn't care as much as it did which OS you use. 

In an ideal Microsoft world, Linux would just be another flavor of Windows and manageable with the same tools. The big problem with making a single tool like PowerShell is that the underlying systems are very different and there are just too few cmdlets to make doing anything easy. 

I doubt that PowerShell is going to get many conversions from the Linux school of programming.

 

powershelllogo

More Information

PowerShell on Linux and Mac

PowerShell on Linux and Open Source!

PowerShell Official Page.

PowerShell is open sourced and is available on Linux

initialsession: remove curl and wget aliases

 

Related Articles

PowerShell for SQL Server Essentials 

Run Linux Binaries On Windows 10 

PowerShell 3 preview 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin

 

Banner


Insights Into Learning Computer Science
18/12/2024

JetBrains Academy has published the results of a worldwide survey that set out to discover current trends in computer science education and the challenges involved in studying computer science. I [ ... ]



Google Adds Premium Tier To Developer Program
29/11/2024

Google has added a premium tier to the Google Developer Program. The new tier is described as providing "a tailored suite of services to help developers throughout the learning, building and deploymen [ ... ]


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 22 August 2016 )