Ironman Software Forums
Continue the conversion on the Ironman Software forums. Chat with over 1000 users about PowerShell, PowerShell Universal, and PowerShell Pro Tools.
In this post, we’ll look at how to install PowerShell on Raspberry PI OS and enable remoting.
You can enable SSH in Raspberry PI OS by creating an empty ssh
file in the boot volume of the boot disk.
cd /Volumes/boot
touch ssh
You can install PowerShell by using the following command line. This command line comes directly from the PowerShell documentation.
###################################
# Prerequisites
# Update package lists
sudo apt-get update
# Install libunwind8 and libssl1.0
# Regex is used to ensure that we do not install libssl1.0-dev, as it is a variant that is not required
sudo apt-get install '^libssl1.0.[0-9]$' libunwind8 -y
###################################
# Download and extract PowerShell
# Grab the latest tar.gz
wget https://github.com/PowerShell/PowerShell/releases/download/v7.2.0/powershell-7.2.0-linux-arm32.tar.gz
# Make folder to put powershell
mkdir ~/powershell
# Unpack the tar.gz file
tar -xvf ./powershell-7.2.0-linux-arm32.tar.gz -C ~/powershell
# Start PowerShell
~/powershell/pwsh
Now that PowerShell is installed, you can setup the SSH server to use the PowerShell subsystem.
Open the SSH config file in nano
.
sudo nano /etc/ssh/sshd_config
Next, add a new line to the file.
Subsystem powershell /usr/bin/pwsh -sshs -NoLogo
Finally, save the file by exiting with Ctrl+X
then press Y
and Enter
.
Once the file is saved, you’ll need to restart the SSH service.
sudo systemctl restart sshd
Now that remoting is configured, you can connect to your Raspberry PI from a Windows machine with the SSH transport.
Enter-PSSession -HostName raspberrypi -Username pi -SSHTransport
pi@raspberrypi's password:
[pi@raspberrypi]: PS /home/pi> gps
Find this useful? Please consider sharing this article. Have a question about PowerShell? Contact us and we'll write a post about it.
Continue the conversion on the Ironman Software forums. Chat with over 1000 users about PowerShell, PowerShell Universal, and PowerShell Pro Tools.
Receive once-a-month updates about Ironman Software. You'll learn about our product updates and blogs related to PowerShell.