This is my favorite time of the year! Holiday parties, family and friends and presents!
My favorite present so far is the new version of PowerShell v6 RC2. If you read my my last post, I mentioned that I would like to run my home dashboard on a Raspberry Pi with Windows 10 IoT but PowerShell did not yet support it. As of the v6.0.0-rc.2 release, you can now run PowerShell on the Pi! The new Windows ARM build of PowerShell v6 wraps this support up into a nice little package.
Installing Windows 10 IoT on a Raspberry Pi
The best way to install Windows 10 IoT on your Raspberry Pi is to download the Windows 10 IoT Dashboard. It has a great little wizard that steps you through downloading the correct OS build for your device and flashing your microSD card with it. Once you’ve flashed the chip, put it back into your Pi and boot it up. If your device is already connected to your network, the My devices tab in IoT Dashboard should find it and list it there.
Double-clicking the device will bring you to a page with a link to take you to the device’s portal in your browser.
Installing PowerShell v6 on the Raspberry Pi
Windows 10 IoT already comes with PowerShell installed on it. It’s a trimmed down version of PowerShell v5 running on a trimmed down version of .NET. It’s not quite .NET core and missing some of the .NET Framework assemblies that I required for Universal Dashboard so I was unable to use it for my purposes.
Having PowerShell already installed on it means that you can use PowerShell Remoting to manage the device. To enable PowerShell Remoting, follow the documentation on the Windows IoT docs page.
Once you’ve enabled PowerShell Remoting, you can follow the steps on the PowerShell GitHub page for Nano Server to copy the PowerShell v6 binaries and unzip them on the Pi.
My steps were as follows.
First, I downloaded the PowerShell-6.0.0-rc.2-win-arm32.zip
Next, I copied the ZIP over to the Pi over PowerShell Remoting and extracted it into the C:\ drive.
Presto! I was then able to run PowerShell v6 on the Pi. Just like that.
Running a Dashboard on the Pi
Now that PowerShell v6 is installed, the Pi is capable of running Universal Dashboard. You’ll need to download version 1.3.0-beta4 or later. I used the same technique that I used to install PowerShell v6 on the Pi to install Universal Dashboard. I created a ZIP of the module and then extracted it to the Modules folder of the PowerShell v6 installation.
You should also be able to use Install-Module to directly download Universal Dashboard from the PowerShell Gallery. Make sure to use -AllowPrerelease to get the latest beta version. This is my modules directory after installing UniversalDashboard.
The next step is to create a firewall rule to allow access to the dashboard. I just used netsh.
netsh advfirewall firewall add rule name="UD Web Server port" dir=in action=allow protocol=TCP localport=8081
To start Universal Dashboard, we need to just run the Start-UDDashboard cmdlet. With the release of 1.3.0-beta3 you can now update dashboards remotely with Update-UDDashboard. This means we don’t need to deploy the entire dashboard directly to the Pi. All we need to do is start the dashboard and then set the -UpdateToken parameter. This parameter is used to authenticate update requests.
I used Copy-Item with the ToSession parameter to move the dashboard PS1 file to the Pi and then started PWSH.
Once the script is running, the dashboard web server will be accessible via any HTTP client. You should see the default dashboard for Universal Dashboard. It took my Pi about 10 seconds to load the first page but after that it’s lightning quick.
The final step is to push the dashboard content to the Pi. You can run this step from any box that can access the Pi via TCP. This uses the new Update-UDDashboard cmdlet to push dashboard content to the remote machine. This removes the need to remote back into your Pi every time you want to update your dashboard.
After you push the changes to your device, the web page should automatically reload and you should have a new, shiny dashboard running on a tiny, little computer.
You can get the latest Universal Dashboard on the PowerShell Gallery. I hope you get all your nerdy friends a Raspberry Pi for Christmas with a shiny, custom dashboard on it!