Alright, I hear the comments now from the Linux guys, me included. PowerShell on Linux? Well yes, Microsoft has released PowerShell for Linux and OS X. It is available here https://github.com/PowerShell/PowerShell. Feeling a bit adventurous? Go ahead and download the Alpha and start playing.
Here are the Installation instructions as per Microsoft.
Currently supports Ubuntu 14.04, Ubuntu 16.04, CentOS 7, and OS X 10.11.
Download the latest Debian package from the releases page onto the Ubuntu machine. At current writing it is powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb.
Open a terminal session:
$ sudo apt-get install libunwind8 libicu52 $ sudo dpkg -i powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb
Download the latest Debian package from the releases page onto the Ubuntu machine. At current writing it is powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb.
Open a terminal session:
$ sudo apt-get install libunwind8 libicu55 $ sudo dpkg -i powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb
Download the latest RPM package from the releases page onto the CentOS machine. At current writing it is powershell_6.0.0-alpha.9-1.el7.centos.x86_64.rpm.
$ sudo yum install powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm
This package should work on Red Hat Enterprise Linux 7 too.
OS X 10.11
Download the PKG package from the releases page onto the OS X machine. At current writing it is powershell-6.0.0-alpha.9.pkg.
Double-click the file and follow the prompts, or install it from the terminal using the following command.
$ sudo installer -pkg powershell-6.0.0-alpha.9.pkg -target /
Here are the Path details according to Microsoft.
$PSHOME is /opt/microsoft/powershell/6.0.0-alpha.9/
User profiles will be read from ~/.config/powershell/profile.ps1
Default profiles will be read from $PSHOME/profile.ps1
User modules will be read from ~/.local/share/powershell/Modules
Shared modules will be read from /usr/local/share/powershell/Modules
Default modules will be read from $PSHOME/Modules
PSReadLine history will be recorded to ~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
The profiles respect PowerShell’s per-host configuration, so the default host-specific profiles exists at Microsoft.PowerShell_profile.ps1 in the same locations.
Note that because OS X is a derivation of BSD, instead of /opt, the prefix used is /usr/local. So replace /opt with /usr/local from the output above.
The real question is how does it look and what can you do? We’ll I took the chance and installed it on a CentOS 7 server. Here’s a bit on what we found.
Installation was simple following the steps.
To start it up type powershell.
Available modules are in the /opt/microsoft/powershell/6.0.0-alpha.9/Modules directory.
Run Get-Modules to list available Modules.
Find out what get commands are available by running the Get-Command.
Have fun exploring what is available!