Installing PowerShell on Linux (Ubuntu 18.04)

As all you already must to know, I am a Linux enthusiastic, especially when it comes Ubuntu. But the truth is that in each company in which I had to work for the last five years, they are companies that base their technology platform mostly on Windows Server operating systems.

Because of that, I had to manage Windows servers, but little by little I am including services running on Linux servers, the great advantage all Linux users / administrators know. However, sometimes the integrations require using scripts in PowerShell, that’s why I have installed what is necessary to be able to call PowerShell for WMI queries to Windows servers from my natural BASH, PHP or Python scripts. So then, below, the step by step of how to install the PowerShell console on my Linux operating system (Ubuntu 18.04)

# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb

# Update the list of products
sudo apt-get update

# Enable the "universe" repositories
sudo add-apt-repository universe

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh