We begin by installing the necessary dependencies, most of which should already be installed in your Kali installation by default.
apt update && apt -y install curl gnupg apt-transport-https
Next, we need to download and add the public repository GPG key so APT will trust the packages and alert you to any issues with package signatures.
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add –
With the GPG key added, we proceed to add the Microsoft package repository to its own package list file under /etc/apt/sources.list.d/ and update the list of available packages.
echo “deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main” > /etc/apt/sources.list.d/powershell.list
Finally, we proceed to install the PowerShell package.
apt -y install powershell
When the package installation completes, running pwsh will start up PowerShell, presenting us with the familiar “PS” prompt.
If you’re new to PowerShell, one of the first things you will likely want to do is update the built-in help, which can be done by running the Update-Help Cmdlet. This may take a little while to complete but only really needs to be run once in a rare while.