With some many windows or Linux Administrators in the world automation has always been top most requirement. PowerShell
is one the most widely and command line shell which gives you string ability to perform any tasks with any remote operating system very easily.
In this tutorial we will go through basic definition of PowerShell, benefits and features of PowerShell and finally how to install latest PowerShell on both Windows
and Ubuntu
Machine.
Table of content
- What is PowerShell?
- Working with PowerShell
- Install PowerShell 7.1.3 on Windows Machine
- How to Install PowerShell 7.1.3 on Ubuntu Machine
- Conclusion
What is PowerShell?
PowerShell
is a command line tool or command line shell
which helps in automation of various tasks , allows you to run scripts & helps you in managing variety of configuration. PowerShell runs on Windows
, Linux
and macOS
PowerShell is built on .NET Command Language Runtime
that is ( CLR ) . It works currently on .NET 5.0 Framework as its runtime.
Features of PowerShell
- It provides tab completion
- It works with all .NET Frameworks objects
- It allows pipelines of commands.
- It has built support for various file formats such as JSON, CSV and XML
Working with PowerShell
PowerShell is a command line tool or command line shell which was meant for windows automation . But it has widely grown and upgraded with lots of feature and benefits. Lets check out some of the key benefits.
- PowerShell can be used for cloud management such as retrieve or deploy new resources.
- PowerShell can be used with Continuous integration and continuous deployment pipelines i.e.. CI/CD
- PowerShell is widely used now by Devops and sysops engineers.
- PowerShell comes with hundreds of preinstalled commands
- PowerShell command are called cmdlets
To check the version of PowerShell , although there are various command but lets run the following
$PSVersionTable.PSVersion

Install PowerShell on Windows Machine
By default PowerShell is already present on the windows machine. To verify click on start bar and look for PowerShell.

- Verify the current version of PowerShell by running the following command.
Get-Host | Select-Object Version

- Lets download the Latest
PowerShell 7.1.3
from here PowerShell-7.1.3-win-x64.zip
- Extract the downloaded binary on the desktop

- Execute the
pwsh.exe

- Now you should see
PowerShell version7.1.3
when you run the following command.

- Lets verify PowerShell by invoking the
Get-Command

How to Install PowerShell 7.1.3 on Ubuntu Machine
We will install PowerShell on ubuntu 18.04 via Package repository. So lets dive in here and start
- Update the list of packages
sudo apt-get update
- Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
- Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

he apt software repositories are defined in the/etc/apt/sources.list
file or in separate files under the/etc/apt/sources.list.d/
directory.
- Register the Microsoft repository GPG keys. You will notice that as soon as we run the below command a repository is added inside /etc/apt/source.list.d directory
sudo dpkg -i packages-microsoft-prod.deb


- Update the Repository again
sudo apt-get update
- Enable the “universe” repositories
sudo add-apt-repository universe
- Install PowerShell
sudo apt-get install -y powershell
- Start PowerShell
pwsh

- Lets verify PowerShell by invoking the
Get-Command

Conclusion
This tutorial is pretty straightforward and to get you started with PowerShell. In this tutorial we defined what is PowerShell and what are benefits of PowerShell. Later we Installed Latest PowerShell 7.1.3
on both ubuntu and windows machine. Hope this tutorial helps you with PowerShell setup & please share it if you like.