Home > Sample chapters

Configure devices and device drivers

Skill: Manage driver packages

When device drivers are created by the original equipment manufacturer (OEM), they are deployed with the hardware in a driver package that includes all the files and information required for Windows 10 to communicate with the hardware. You see how driver packages are managed and how to install, provision, and import driver packages on Windows 10 devices.

Use the driver store

You saw earlier that the driver package can include an information file (.inf file), any files that the .inf file references, and a .cat file that contains the digital signature for the device driver. Windows 10 uses the Driver Store to hold device drivers that have been installed or pre-staged.

All Windows 10 kernel mode drivers must be digitally signed by the Windows Hardware Developer Center Dashboard portal. Windows 10 will prevent the loading of new kernel mode drivers that are not signed by the portal. This is an important change from previous versions of Windows and will make the operating system more secure. Previously, it could be possible for a hacker to gain unauthorized access to a system by using a flaw in an unsigned device driver. Ensuring that all drivers are digitally signed will remove the ability for a hacker to add or modify device driver contents.

If you are creating a custom installation image, or if you build and deploy many computers, you can speed up the driver installation process by pre-loading the Windows 10 driver store with the specific drivers for the peripheral devices that your devices will be using. When Windows 10 finds the drivers it needs in the driver store, located in %SystemRoot%\System32\DriverStore, it uses these local drivers and does not download them from Windows Update.

Pre-installing a driver is a two-stage process, and the first stage must be carried out with administrator credentials. You need to add the driver package to the driver store and then ensure that the hardware is attached; Windows 10 then automatically locates and installs the local driver.

There are a few ways to deploy drivers to the driver store, and the most appropriate method will depend on your physical network infrastructure, network connectivity, and level of administrative privileges on devices, among other things.

Use PnPUtil.exe to manage driver packages

To pre-stage the installation of a specific hardware device, you can install a driver manually before connecting the device, by using the PnPUtil.exe command-line tool. This could be useful when distributing a laptop to a remote user who you know has a local printer or scanner. Standard users cannot normally install device drivers, but if the driver package is already in the driver store, this is possible.

Run the PnPUtil.exe command by using administrative privileges, and you can use it to manage the Driver Store, adding, deleting, and listing driver packages. You saw earlier that a driver package consists of all the information Windows 10 requires to install and trust the driver, including the following.

  • Driver files Dynamic link library (DLL) files with the .sys file extension.

  • Installation files Text files containing all the information needed to install a driver. These .inf files include information such as driver name and location, driver version information, and registry information. These files are copied to the %SystemRoot%\Inf directory during installation. Every installed device must have an .inf file.

  • Driver Catalog file Contains a cryptographic hash of each file in the driver package. These hashes are used to verify that the package was not altered after it was published (created). Digitally signing the catalog file proves the file has not been altered, because only the digital signature owner can sign the file.

  • Additional files These are files such as a device installation application, device icon, device property pages, and additional files.

For enhanced security, Windows 10 now uses a single kernel model across all editions of Windows 10 and is encouraging the use, now, of a new universal driver model. This universal .inf file is required when deploying device drivers to an offline system image, such as when building a Windows 10 Mobile system (which does not support Plug And Play).

The syntax for the PnPUtil.exe command-line tool is as follows.

PnPUtil.exe –a <path to the driver> \<drivername>.inf

The full list of parameters is shown in Table 3-1.

TABLE 3-1 PnPUtil.exe parameters

Parameter

Description

-a

Adds a driver package to the driver store

-d

Removes a driver package from the driver store

-e

Lists the driver packages that are currently in the driver store

-f

Forces the deletion of the specifi ed driver package from the driver store; cannot be used with the -i parameter.

-i

Installs the driver package on matching devices that are connected to the system. Cannot be used with the -f parameter

/?

Displays help

An example command to add the INF file specified by MyDevice.inf to the driver store (located at %SystemRoot%\System32\DriverStore) is:

PnPUtil.exe -a C:\Temp\MyDevice.inf

In addition to the PnPUtil.exe tool, you can use the following Windows PowerShell cmdlets.

  • Get-PnpDevice Displays information about PnP devices

  • Get-PnpDeviceProperty Displays detailed properties for a PnP device

  • Enable-PnpDevice Enables a PnP device

  • Disable-PnpDevice Disables a PnP device

An example Windows PowerShell command to enable the device with an instance ID of ‘USB\VID_5986&;PID_0266&;MI_00\7&;1E5D3568&;0&;0000’ is as follows.

PS C:\> Enable-PnpDevice -InstanceId 'USB\VID_5986&;PID_0266&;MI_00\7&;1E
5D3568&;0&;0000'

For more information about, or for the syntax of, any of the Windows PowerShell cmdlets, you can use the Get-Help <cmdlet name> cmdlet such as the following.

Get-Help <cmdlet name> -Examples