<img alt="" src="https://secure.hims1nice.com/151009.png" style="display:none;">
" style="background-color: #2c3e50;">
 

Blogs

Installing Wifi Drivers in Windows 10 IoT Core with PowerShell

Posted by Mike Branstein on Sep 6, 2016 3:00:00 PM
Mike Branstein
Find me on:

This post is the third in 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.

Windows Core IoT Internet of Things

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 via PowerShell
  • Install WiFi drivers in Windows 10 IoT Core with PowerShell (this post)

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 Are 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 that Copy-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 temporary location because this is where 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 on 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).


Check out our free, hands-on, IoT development workshop series!

Upcoming Events

Topics: IoT (Internet of Things)

Subscribe Here!