Microsoft’s PowerShell offers Raspberry Pi users access to a powerful scripting environment for task automation. With PowerShell’s robust set of cmdlets and capabilities spanning Windows and Linux systems, Raspberry Pi becomes an even more versatile device for IT professionals and hobbyists.
Installing the latest iteration of PowerShell on Raspberry Pi only takes a few quick steps. This guide will walk through the process to get you up and running with PowerShell on your Raspberry Pi device.
Before installing PowerShell, ensure your Raspberry Pi environment meets these requirements:
- Raspberry Pi OS Bullseye or later
- ARMv7l or ARM64 architecture
- .NET 6 Runtime or later
- 20MB free disk space
Step 1 — Install .NET 6 Runtime
PowerShell 7 and later requires .NET 6 Runtime or newer.
Install the necessary package with this apt command:
sudo apt-get install -y libicu66
Next, enable the Microsoft package repository:
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
Finally, install .NET Runtime with:
sudo apt-get update
sudo apt-get install -y aspnetcore-runtime-6.0
These commands add the required repositories, public key, and .NET environment needed for PowerShell.
Step 2 — Install PowerShell
With .NET available, installing PowerShell is straightforward:
Download the ARM64 package
Install the package
sudo dpkg -i powershell-lts_7.3.0-1.debian.11_arm64.deb
The PowerShell package works on ARMv7l and ARM64 architectures. This downloads the 64-bit ARM package, installs it, and launches the pwsh environment.
Upon launch, the output should show the PowerShell banner and version details:
Type ‘help’ to get help.
That’s it! PowerShell is now up and running on your Raspberry Pi device.
Using PowerShell on Raspberry Pi
With PowerShell installed, try out some basic commands to verify it is working properly:
Get OS Details
List Disk Info
Show Memory Use
Get-Process | Sort-Object VM -Descending | Select-Object VM,Name -First 5
These cmdlets retrieve system information, storage details, and current memory usage.
PowerShell also includes powerful scripting capabilities using .ps1 files. For example, to create a simple script:
$ps1 = “test.ps1”
Add script logic
$content = @”
Write-Output “My first PowerShell script on Raspberry Pi!”
Write output to script
$content | Out-File $ps1
Run the script
This demonstrates the cmdlet-based syntax, here-string multi-line content, and script execution available within the pwsh environment.
With PowerShell working as expected, your Raspberry Pi now has access to thousands of cmdlets for scripting Windows, Linux, networking, cloud, and other administration tasks.
Installing PowerShell on Raspberry Pi takes just a few quick steps:
- Ensure you have Raspberry Pi OS Bullseye or newer. ARM64 architecture requires 64-bit OS
- Install .NET 6 Runtime from Microsoft package repository
- Download and install Powershell package for ARM processor
- Launch with pwsh and test basic cmdlets
PowerShell transforms Raspberry Pi into an incredibly versatile automation device – on par with any Windows or Linux workstation.
Getting PowerShell operational on Raspberry Pi requires .NET framework and the Linux arm package. By adding Microsoft repositories and installing the PowerShell deb file, users unlock access to cross-platform scripting and advanced Windows/Linux management right on Raspberry Pi.
With PowerShell fully functioning, explore cmdlets for system tasks, networking, clouds, containers, security, and more. PowerShell helps optimize Raspberry Pi capabilities and interoperability even further.
Frequently Asked Questions
- Is PowerShell 7 compatible with Raspberry Pi OS?
Yes, PowerShell version 7 and later works on multiple Raspberry Pi OS iterations including Buster and Bullseye. It requires .NET 6 Runtime.
- Can I install PowerShell on Raspberry Pi 3?
Yes, PowerShell can be installed on any RPi model capable of running 64-bit or 32-bit Raspberry Pi OS Bullseye.
- What Raspberry Pi OS do I need?
Raspberry Pi OS Bullseye or newer. For 64-bit ARM devices, Bullseye ships with a 64-bit kernel by default.
- How do I update Raspberry Pi OS to 64-bit?
Use the rpi-update command if on an older OS, or download and install Bullseye 64-bit image.
- Does PowerShell work on Raspberry Pi 400?
Yes! The Raspberry Pi 400 can run PowerShell the same way as other Pi devices once RPi OS Bullseye 64-bit is installed.
- Can I use PowerShell on Raspberry Pi Zero?
Yes, PowerShell works on the Raspberry Pi Zero line. The Pi Zero and Pi Zero 2 are both 32-bit ARMv6, so use the ARMv7l PowerShell package.
- How do I launch the PowerShell prompt on Raspberry Pi?
Use the pwsh command after installing PowerShell. This loads the PowerShell 7+ interactive shell.
- Why pwsh and not powershell?
pwsh is the updated PowerShell Core executable, distinct from Windows PowerShell. So Linux and macOS use pwsh.
- How can I run PowerShell scripts on Raspberry Pi?
Save scripts as .ps1 files, ensure execute permissions, then launch with ./scriptname.ps1 from the PowerShell prompt.
- Is there a PowerShell module repository for Raspberry Pi?
Yes, the PowerShell Gallery contains Linux and ARM-compatible scripts and modules to further enhance capabilities.
- Can I connect to Windows from PowerShell on Raspberry Pi?
Yes, PowerShell offers robust remote management capabilities including PSRemoting for seamless Windows/Linux admin.
- Is there an ISE or GUI for PowerShell on Raspberry Pi?
Yes! Install the PowerShell ISE module, or explore Visual Studio Code with the PowerShell extension.
- How do I remove or update PowerShell on Raspberry Pi?
Use the standard apt-get remove and apt-get upgrade commands for the powershell-lts package.
- Why does Install-Module fail on Raspberry Pi?
PowerShell Gallery requires TLS 1.2+ which needs openssl 1.1.1 on Linux. Check with openssl version and update if too old.
- Can I automate Windows tasks from Pi?
Yes! Once configured for PSRemoting, RPi can remotely manage Exchange, Office 365, SQL Server, and more on Windows Servers.
- Is there a Raspberry Pi PowerShell SDK?
Yes, the PowerShell SDK contains ARM builds to compile custom modules and cmdlets optimized for Raspberry Pi.
- What modules work best on Raspberry Pi?
Useful modules include FileTransfer, SSHRemoting, DockerCompletion, and more from the PowerShell Gallery. The Pi-specific LernwerkstattModules offers additional functionality.
- Can PowerShell access GPIO pins?
Yes! The PiGpio module enables full GPIO pin access including voltage levels, PWM, interrupts, serial, and SPI communications over the GPIO interface.
- Is PowerShell the best shell for Raspberry Pi?
While Bash and Zsh remain popular, PowerShell offers greater versatility with easy Linux/Windows interoperability plus powerful automation capabilities.
- What else can I do with PowerShell on Raspberry Pi?
Manage file systems, access APIs, manipulate system resources, control GPIO devices, enable CI/CD workflows, and handle nearly any other task with easy scripting using cmdlets.