This post is the third of a series describing our automation efforts for provisioning Windows 10 IoT core on a Raspberry Pi. To recap, KiZAN has a lab of 26 Raspberry Pi 2 boards running Windows 10 IoT core. On a regular basis, we need to re-flash, provision, and configure the boards. When we perform the re-flash and provisioning process, it is manual, and consumes more time than we want to spend (up to 2 days). In this post, you’ll learn how to use PowerShell to remotely install WiFi drivers on a Windows 10 IoT core device.
Posts in this series:
- Find the IP Address of a Windows 10 IoT Core Device after Initial Flash with PowerShell
- Rename a Windows 10 IoT Core device with PowerShell
- Install WiFi drivers in Windows 10 IoT core with PowerShell
Overview
In the previous posts, you learned how to find the IP address of a device and rename it with PowerShell. When our devices (Raspberry Pi 2’s) are initially provisioned, they are connected to a wired network. Ideally, we’d like the devices to run on WiFi, but Windows 10 IoT core didn’t natively support the WiFi adapter, Edimax, that is installed on our Raspberry Pi 2’s. Loading the drivers can be automated, so we’ll review the steps we did to automate the process. At a high-level these steps were:
- Establish remote PowerShell session (see how we did this in our previous post – LINK to Rename a Windows 10…)
- Copy WiFi drivers to a device
- Remotely execute driver installation script
Copy WiFi drivers to a device
To copy WiFi drivers to a device, we used the Copy-Item
command. Copy-Item
takes files from the local machine I am working from and copies them to a remote device by passing in a remote session.
There’s a few parameters I want to highlight:
- The
-ToSession
parameter tells the command to copy the items remotely -Path
is the path where the files to copy to the session are located. (This path is found on the local machine running the command.)-Destination
is the location to copy these files to on the specified device.-Recurse
tells the machine to copy every file in the \Driver\ folder, and sub-folders.-Force
indicates thatCopy-Item
will copy items that cannot otherwise be changed such as read-only files.-ErrorAction
tells the cmdlet (Copy-Item
) that when there is an error, continue over it without stopping the script.
The destination folder on the device is the EFIESP folder. This is a special folder where the boot file and start files are located. It is a good temp location because this is where the other files similar to this are stored and referenced.
Remotely execute the driver installation script
After we copy the files to the device, we have to install them. We do this by running a remote PowerShell script in a separate file. This is run with the cmdlet Invoke-Command
.
Invoke-Command
uses the session corresponding to the device it will install the drivers on. The Install Driver PowerShell script is below.
The first line changes the directory to be in the location where the drivers are located. The second line installs the drivers. When we use the devcon
command, three warnings are displayed to the screen, followed by two more lines. The first says “Updating drivers for USB\VID_7392&PID7811 from C:\EFIESP\temp\netrtwlanu.inf.” The second line says “Drivers installed successfully” if they are successful.
As you’ve just seen it’s pretty easy to install the WiFi drivers, and we built upon several steps we did in our previous posts. In the next post, I’ll describe how to disable Windows Update (and why we’re doing it).
Many thanks to Ryan DiChiara, one of our summer interns for doing a lot of the legwork (and writing) this post!