PowerShell Open Sourced and Available on Linux and MacOS

No joke here. It was announced today at 11:14am (fun fact: this is when PowerShell V1 was released which was on November 14th,  2006) that PowerShell is not only being open sourced, but also is now available to install on Linux and MacOS. This is huge as being able to run PowerShell on anything other than Windows seemed like a pipe dream. But here it is! I won’t go crazy here listing out everything that has already been said before and those links are located at the bottom of this article. I just wanted to highlight some awesome things about this announcement.

You can head out to Github (https://github.com/PowerShell/PowerShell) right now and take a look at it in its open source glory! You will also notice a flurry of activity on its Issues page and also add your own as well!

image

Now, I mentioned that Linux is now an OS that supports running PowerShell. Currently there are a few distributions that it seems to support in Ubuntu and CentOS, but I imagine that more will be added as time progresses. Also MacOS is included in the list that you can install it on.

image

With this being an Alpha release, there will be bugs…lots of them…but that is OK because in its current state, it is pretty awesome! And that only means things will continue to be more and more better as the team takes in all of the issues (both internal and external) and fixes those as well as other things that they want to work on.

Installing on Ubuntu 14.04

Let’s go ahead and perform an install on a Linux system. In my case, I went ahead and installed Ubuntu 14.04 on my virtual environment so I could try this out!

The download package for this is at https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.9/powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb which I placed in the downloads folder under my home share.

I then navigate to that location and run the following commands:

sudo apt-get install libunwind8 libicu52
sudo dpkg -i powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb

Once that has completed, I simply run PowerShell to load the shell.

image

The first thing I notice when running $PSVersionTable is that this is the alpha for version 6.0.0. Also note that the PSEdition is Core, meaning that this is running on .Net Core and probably missing some features that we are used to on the Windows side.

Looking at the variables, I see 4 that really stand out to that help to determine whether this system is running CoreCLR, is either Linux, Windows or OSX.

image

Some cmdlets are missing, such as Get-EventLog and Get-Service. Also noticeably missing are the CIM cmdlets.

image

Some things such as Desired State Configuration and Pester are available to use.

Aliases are also not as they seem in this version of PowerShell.

image

The Linux commands for ls and ps are not treated like PowerShell aliases currently, so you definitely want to keep that in mind. Also, case sensitivity, while not worried about in Windows should be respected here not for the commands, but for the file/folder structure.

image

Community Support

So with that announcement, when are we going to see some community involvement with porting their modules over to support Linux? Well, that is happening now! For instance, I am working on my PoshRSJob module to bring it into the Linux fold.

ubuntu_runspace

Needless to say that it is not there yet. I am seeing issues with what are usually public properties now being made private.

ubuntu_runspaceconfig

Will that change? I don’t know but I am working to work around that so I can have my module provide cross platform support to the masses Smile.

So with that, go ahead and give PowerShell a try on Linux or OSX and let everyone know how you like it. Got a bug or issue, drop over to GitHub and let the team know so they can prioritize it and make it better!

Reference Links

http://www.powershellmagazine.com/2016/08/18/open-source-powershell-on-windows-linux-and-osx/

https://blogs.msdn.microsoft.com/powershell/2016/08/18/powershell-on-linux-and-open-source-2/

https://azure.microsoft.com/en-us/blog/powershell-is-open-sourced-and-is-available-on-linux/

This entry was posted in powershell and tagged , , , , , . Bookmark the permalink.

Leave a comment