Microsoft has open sourced PowerShell, it’s automation tool and command line shell. That’s not all, PowerShell is also coming to Linux. The alpha release of PowerShell for Linux is available on the GitHub page; you can test it on Ubuntu, Debian and CentOS. The source of PowerShell is also available on GitHub.
Surviving in the multi-cloud world
Microsoft has been kind of behind the UNIX (Linux) world when it comes to feature rich command line interfaces and tools. PowerShell was Microsoft’s answer to those developers who wanted such capabilities. Thanks to its .NET Framework base PowerShell has some great scripting capabilities….but it doesn’t have everything. It can’t cater to everyone.
Customers live in a multi-OS, multi-platform, multi-cloud world. They use a mix of technologies. And they want flexibility, they want choices of servers, choices of clouds.
Microsoft’s own Azure cloud is witnessing an increase of Linux virtual machines. And Microsoft needs to address the needs of sysadmins, DevOps so that it reduces the complexity of managing Windows and Linux machines from the same client.
“It turns out that's a really hard thing to do, particularly because of the different architectures of the systems,” said Jeffrey Snover, father of PowerShell in an interview with CIO.com. “What we're trying to do is have a single-management stack to be able to manage all the workloads for customers, whether they're Windows or Linux, and then allow the customer to be able to manage those on any cloud and from any client that they want. That's really what we're trying to achieve.”
Since PowerShell lacked the capabilities to manage Linux machines, Microsoft worked with Canonical to bring Linux bash shell to Windows to enable developers in managing their Linux servers from within Windows 10. And now Microsoft is creating an even playing field by porting PowerShell to Linux. So that developers running Linux can manage their Windows and Linux servers.
To port or not to port
Windows and Linux are two different worlds. For example, Windows doesn’t respect case sensitivity, Linux does; Windows uses backward slash for path, Linux uses forward slash. At the same time there are many commands in the Windows world that don’t make sense in Linux. So not everything will be ported to Linux.
Snover explained there are many different things that go into deciding what to port and what not to port. There is one core PowerShell that’s been ported to Linux, which includes scripting language, interactive shell and configuration management.
There are other capabilities of PowerShell, such as interacting with AWS and VMware. That’s also ported to Linux.
Then there are Windows-specific things like event logging or managing registries that make no sense on Linux. These windows commandlets will not be ported to Linux; they will be open sourced, but not ported.
One shell to rule them all?
Does that mean I can do everything from the Linux terminal or do I need to open a new app? Snover explained that PowerShell is just another shell in the Linux world. You can think of it as a merger between bash and Python. You can change your default shell to PowerShell and call all native Linux capabilities from there including cat, ls, ps...It’s just another shell on Linux.
But what makes it interesting is that it brings the rich object model, rich scripting and language features to Linux. This becomes important when you are dealing with structured data.
Historically, the UNIX/Linux world has been unstructured data, said Snover. But it’s moving to structured data with use of REST APIs and JSON objects. And that’s where, according to him PowerShell does a much better job.
Why open source it?
Open source breeds confidence in customers. As Mark Shuttleworth, the founder of Canonical once told me, customers don’t want to be at the mercy of single vendor. They want to be able to patch bugs, they want to become an active participant in the development of the very technology they rely on. Open source ensures that.
“People have not had the benefit to take a look at our source code to see world-class production .NET code, so by open sourcing our code, people are able to just look at our code and learn from it,” Snover said. “If they ever wonder about how the system is working, or they get an error message which isn't as good as it should been, they're able to go into the source code and see exactly how the system works. It facilitates learning about the system and how it really works.”
PowerShell will be developed in the open, and there will be a governance model to dictate how the project will be managed. When I asked who can contribute to it, Snover said that they will soon announce the governance model but anyone “can make the change themselves and submit that change through a pull request, and if it meets our criteria we'll just bring that into the system and then they'll get their bug fixed.”
That’s the core benefit of open sourcing your technologies, because suddenly your customers become your contributors. “It benefits us because we get a better, higher-bandwidth conversation with our customers and we also get the benefit of any bug fixes or enhancements that they choose to make,” said Snover.
Compete and collaborate
Microsoft is not doing it alone. They have worked closely with Canonical, who gave Microsoft “advice about how to be a great first-class citizen on the Linux environment,” according to Snover. In addition, Microsoft also worked with Chef, the open source project.
Taking care of legal issues
Ever since the leadership change at Microsoft, the company has been slowly open sourcing components of PowerShell. There are many complexities. There are patent issues, there are copyright issues. “Microsoft has an incredible investment in PowerShell. We've been working on this for over 15 years and we have a fairly large team. We have well over 30 patents. This is a core strategic technology. Sort of a crown jewel, if you will, of Windows server. Taking that and making it available as open source really required a lot of eyeballs, a lot of gut checks,” Snover said.
Microsoft had to get its legal team involved to make sure everyone understood what was going to be the processes and the criteria to take community code and bring it into and allow it to be shipped as part of Windows. “We've be doing this for quite a while, making sure all the parts of the company were involved and ready to make this big, big change,” he said.
openSSH is missing
One of the missing pieces of the PowerShell puzzle is support for openSSH. That’s still in the works. You can’t just ssh into your Linux machines from PowerShell. But the team is working with the openSSH community to port it to Windows, both the client and Windows component of openSSH. “We're taking openSSH and we'll be integrating it into the heart of PowerShell. It will be one of the transports for the PowerShell remoting protocol. Currently it’s layered on top of WinRM but going forward, you'll have the choice of being able to to use WinRM or openSSH. That code is not yet mature enough to release as part of the alpha release, so it's available in a branch and people can play with it. Once it’s in a little better shape it will be part of the main line.”
The balancing act?
There was a segment of Linux users who were complaining about the Microsoft-Canonical partnership that brought the Linux bash shell to Windows. Their concern was that the deal was establishing Windows 10 as a go-to platform for developers, moving them further away from the Linux desktop. With this announcement, Microsoft has balanced it out by providing Linux users with the same capabilities that developers have on Windows 10 through PowerShell. Now developers running Linux machines can easily do the things that they could do on Windows 10.
It also shows that Microsoft is not eating Linux and is in it for the long run. Now Linux is not just a means to an end for Microsoft. The company is building its own core technologies around Linux, so Linux is now as valuable for Microsoft as it is supposedly for Google, Facebook and Amazon.
This article is published as part of the IDG Contributor Network. Want to Join?