· 3 min read
Running the Cross-Platform PnP PowerShell on a Raspberry Pi
On Friday 9th Oct 2020, Erwin van Hunen, the 'father' on PnP PowerShell announced on Twitter the release of the next major version of PnP PowerShell with cross-platform support, running on PowerShell Core. So naturally, like a kid with a new toy, wanted to see if I can get this working on a Raspberry Pi 4.
On Friday 9th Oct 2020, Erwin van Hunen, the “father” on PnP PowerShell announced on Twitter the release of the next major version of PnP PowerShell with cross-platform support, running on PowerShell Core. So naturally, like a kid with a new toy, wanted to see if I can get this working on a Raspberry Pi 4. I was pleasantly surprised to find this was a straight-foreword process, for both setting up PowerShell and installing the module to get going.
Kudos to the PnP team
Before I start, a lot of work has gone into creating the new version of PnP PowerShell, as this also relies on PnP Framework, the next generation of PnP Sites Core. It is worth checking out these resources on the announcements to get more details, on the direction these community tools are going for the future:
Getting Started
The usual prerelease note, both the PowerShell install on a Raspberry Pi is listed as Experimental which is limited to Raspberry Pi 2,3,4 - not Pi Zero’s. Additionally, the new PnP PowerShell module (v0.1.6-nightly) is also a prerelease nightly build - the great thing about Raspberry Pi’s, is you can experiment both hardware and software, so let’s play!
Installing the PowerShell on Raspberry Pi
This part comes from Microsoft, by finding the PowerShell installer for Linux, there is a version for Raspbian, quite simply follow the instructions in this link, and you can quickly get going. The script looks like this, but refer to the above link for the latest updates:
###################################
# 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.0.3/powershell-7.0.3-linux-arm32.tar.gz
# Make folder to put powershell
mkdir ~/powershell
# Unpack the tar.gz file
tar -xvf ./powershell-7.0.3-linux-arm32.tar.gz -C ~/powershell
# Start PowerShell
~/powershell/pwsh
Installing the PnP PowerShell Module (0.1.6-nightly, prerelease)
After PowerShell is installed, start up a session by going:
./powershell/pwsh
After this is installed, use the instructions in the new PnP PowerShell repo - this is a new PowerShell module, not the well known “SharePointPnPOnline” module, run:
Install-Module -Name PnP.PowerShell -AllowPrerelease
After the module is installed, connect to SharePoint, as you would normally do in Windows:
Connect-PnPOnline https://tenant.sharepoint.com
# Enter your credentials then
Get-PnPList
This is another cool example of how to include other types of devices in projects, I look forward to exploring the new options further what you can do with this environment as the module advances. Remember, this will only connect to SharePoint Online, On-Premises support has been removed from the new modules.
References
- Installing PowerShell on Linux - Installing PowerShell Core on linux | Microsoft Docs
- New PnP PowerShell Module GitHub Repo - https://github.com/pnp/powershell
- PowerShell Gallery - PnP.PowerShell module | PowerShell Gallery
Sharing is caring, Enjoy!