Microsoft has open-sourced PowerShell for Linux, Macs. Repeat, Microsoft has open-sourced PowerShell
OpenSSH remoting will be baked in, too
Microsoft has published PowerShell, its scripting and automation platform, as open source under the permissive MIT licence, as well as porting it to Linux and Mac, with an alpha build now available on GitHub.
PowerShell is built on Microsoft's .NET platform, and one of the enabling pieces here is .NET Core, the refactored fork of .NET which runs cross-platform. PowerShell "Core" has already turned up on Nano Server, the barebones edition of Windows Server 2016, and the newly announced release will run on .NET Core on Mac and Linux.
The initial Linux support is for Ubuntu, CentOS and RedHat. "Others will follow," said Jeffrey Snover, a Microsoft technical fellow and creator of PowerShell, speaking to The Reg. "And we’re open-sourcing it. That’s the source code for PowerShell Windows, which is the version that runs on the full CLR, as well as the PowerShell Core."
Another key announcement is that OpenSSH – for remote login using the SSH protocol – will be integrated into PowerShell. "We’re embedding it into the heart of PowerShell," said Snover. "We’re layering the PowerShell remoting protocol over OpenSSH, as a native transport. Customers will be able to choose the existing WinRM protocol or OpenSSH."
Microsoft will also deliver cross-platform PowerShell editing and debugging tools. Rather than attempting to port the Windows ISE (Integrated Scripting Environment), the company has developed a PowerShell Editor Service which plugs into the cross-platform Visual Studio Code as well as other editors.
"Out of the gate we’ll support Visual Studio Code, and also Sublime." said Snover. "We’ll have additional editors that will follow, in particular Emacs and VIM."
Just another Linux shell
PowerShell on Linux is not an alternative to other utilities, but works alongside them. "On Linux we’re just another shell," said Snover. "Today people can use any shell they want to run awk, grep, sed, and so on. We’ll be able to do exactly those things using exactly those tools.
"It turns out that more and more of Linux now is being surfaced as structured data, in particular through REST APIs and commands generating JSON documents. That’s where we’re going to shine."
Microsoft is also encouraging the creation of wrapper functions for commonly used tools. "One of the demos is a wrapper around Cron," Snover said. "Crontab is an ASCII text file, you have to get the right number of commas and the right values in. Now we have a cmdlet, New-Cronjob.” The cmdlet does error checking before accepting a new job. You can also use Get-Cronjob to return existing jobs. "We parse the text and turn it into objects that are easy to manipulate. We believe there is strong value in doing that,” said Snover.
Vendors with PowerShell libraries for their products will be able to port them to the new Core version, and early examples are AWS (Amazon Web Services) and VMware. Steve Roberts, AWS Software Development Engineer, has shown the AWS Tools for PowerShell running on a Mac; and VMware's Alan Renouf has done a similar demonstration using vSphere PowerCLI. "We’ve got commands that will manage every aspect of vCenter administration already," said Renouf.
What about managing Windows products like Exchange, or Exchange Online, from Mac or Linux? The Exchange team has not yet started to port its cmdlets (PowerShell commands), Snover said, but this is still possible using PowerShell remoting. "We can proxy commands that you type and run and they will run on the remote machine. You’ll be able to manage everything from everywhere," he explained.
'Nearly 1 in 3 VMs on Azure are Linux'
Thanks to its Azure cloud, Microsoft is now running serious numbers of Linux virtual servers. "Nearly 1 in 3 VMs on Azure are Linux," said Snover, though they run on Microsoft's Hyper-V hypervisor. Microsoft's PowerShell initiative is part of an effort to make sense of managing heterogeneous servers. The company's Operations Management Suite, which extends System Center with cloud-hosted VM management, uses PowerShell for its automation capabilities, and PowerShell on Linux will give it the infrastructure to work across multiple environments, including Azure, AWS, Google Cloud, and on premises.
Is Microsoft's support for Linux undermining the appeal of Windows server? Snover, who has also been a Windows Server architect, gives an answer reminiscent of what I have heard many times from AWS. "It goes back to Satya [Nadella]’s leadership. He said go talk to customers, meet your customers where they are. We’re confident that if we help our customers be successful we’re going to prosper. The fact that they have a choice is one of the reasons they stay where they are.”
Microsoft technical fellow and PowerShell inventor Jeffrey Snover
PowerShell is proving to be a valuable bridge technology. DevOps and automation specialists like Chef and Puppet use it to help port their Linux-based tools to Windows, and Microsoft will now be using it to help Windows admins manage Linux and vice versa.
An important caveat is that this stuff is far from ready. The initial alpha version does not even have the OpenSSH support, according to Snover. This is in a separate branch and will be integrated into the main release "in a couple of months."
He also warns that there will be changes between the alpha release and the eventual production version, saying that's what an alpha release is for. When do we get the real thing? "The timing of the official Microsoft version will be based upon community input and business needs," says the press release. ®
Sponsored: Beyond the Data Frontier