Microsoft finally open sourced and ported Windows PowerShell to Linux. As we use Windows PowerShell quite often in our daily business we decided to check out and test PowerShell on Linux. I was the happy one, who got the task to try it out.


For the try out I created a new virtual machine using VMWare Workstation 10.x with Ubuntu 14.04 (Just the standard version with GUI).
As a first step, I had to download the debian package of the latest PowerShell release (powershell_6.0.0-alpha.10-1ubuntu1.14.04.1_amd64.deb) from Github.
Then I opened the terminal and had to execute the following commands:

sudo dpkg -i powershell_6.0.0-alpha.10-1ubuntu1.14.04.1_amd64.deb
sudo apt-get install -f

And… that’s it already! Now the PowerShell will work properly on Linux Ubuntu!

Run PowerShell

I then started playing around with it…
To open PowerShell I had to execute the following command in the terminal.


After that, the actual terminal is a PowerShell console.


It works exactly the same like PowerShell on Windows. You can define variables, get constants like [long]::MaxValue, and so on.

Install PowerShell Module

I wanted to install Pester first, but surprisingly it was already installed. So I thought: “ok, if it’s already installed why not playing around with Pester too?”. The Pester version installed was the same as the one I had on my development VM. So the framework works exactly the same way as in PowerShell on Windows. Only the colors are different.


Anyway, the goal was to install a module. After the gathering comes the scattering. Just installing a module via Install-Module -Name MODULE_NAME didn’t work. It threw an exception as shown in the next screenshot.


So I tried to install the module manually. First, I located the folder, where modules will be installed. I loaded a module into a variable and read the parent directory of its ModuleBase. I.e. using Pester (It has nothing to do with the Pester module; you can use any module you want) the commands would look as follows:

$pester = Get-Module -ListAvailable -Name Pester | Select-Object -First 1
$modulesFolder = Split-Path -Parent $pester.ModuleBase

Now I know where the modules folder is located. I installed one of our modules by copying the module folder from my development VM into the modules folder. After that I checked, if the module gets listed when executing Get-Module -ListAvailable -Name MODULE_NAME.

It worked!

The module got installed successfully and I could use the Cmdlets of the modules. There are still many things to play around with in PowerShell on Linux, but I think this will be sufficient for now.

I like PowerShell on Linux a lot. It’s much better than the default Bourne Again Shell (short: bash). Strange thing is, you have the same syntax, but it doesn’t feel like the PowerShell on Windows. It’s the same, but different. But still the same.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.