Using PowerShell to find drivers for Device Manager

One of the most arduous tasks for a ConfigMgr admin is to build images to support new models of hardware for Operating System Distribution. As a SCCM Engineer, I’ve done this process for probably more than a hundred models now, and here’s how it normally goes.

How I solve missing drivers

• Connect my new device to the network
• Do a fresh install off of a thumb drive or PXE of my current image and see what breaks
• Boot into Windows and then look at Device Manager.

At this point, I’ll either jump up and down or I start crying, based on how many of my devices have an Exclamation point.

unhappy_device_manager

The process to figure out the device is to look at the device, in device manager->Properties->Details->Hardware IDs

How to find devices

I then lookup the info in an online repository. Like the PCI Database or Windows Update to find the actual driver from the vendor.

How to search

This works…but it could be better.

Using PowerShell

Johan Arwidmark is a well-respected SCCM God. He’s pretty much the best, period. He had a great blog post about the method he uses to find drivers, centered around a Walkthrough on a newer Lenovo system.

If you look into that post you’ll find a PowerShell one-liner that gives you a listing like this:

Johan

Which you can then use to step through your hardware reference site of choice.

Taking it one step further

I’ve been wanting to write something like this for a while, and a conversation with my friend Julie Andreacola over at CBfive prompted me to start coding. Why look up item by item, when you can use PowerShell to search through all of the listings and resolve all the names at once? Full download link on the text below.

Get-UnknownDevices

Using Johan’s code as a starting point, I’ve expanded it out, to now locate missing devices, grab the hardware and vendor IDs and then search the database for the device name using PowerShell!

Standard output looks like this

Get-UnknownDevices Standalone

When used in conjunction with an offline machin, simply Export the file

Export

Then Import on another system with Internet Access using the -Import switch to resolve those drivers issues

Import

I hope you like it! Full code will live on GitHub here :
https://github.com/1RedOne/Get-UnknownDevices

Advertisements

5 thoughts on “Using PowerShell to find drivers for Device Manager

  1. Mike July 31, 2015 / 2:13 pm

    validation fail.

    C:\tools\Get-UnknownDevices-master\Get-UnknownDevices.ps1 : Cannot validate argument on parameter ‘Export’. Cannot bind argument to parameter ‘Path’ because it is null.
    At line:1 char:34
    + .\Get-UnknownDevices.ps1 -Export c:\tools\import.csv
    + ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [Get-UnknownDevices.ps1], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Get-UnknownDevices.ps1

    • FoxDeploy July 31, 2015 / 2:20 pm

      Make sure you have a C:\tools folder. This tool will validate your path to make sure it exists before beginning. If you don’t have C:\tools, you’re going to see an error.

      • Mike July 31, 2015 / 2:45 pm

        It’s weird, because this works fine.

        PS C:\> .\Get-UnknownDevices.ps1 | export-csv c:\export.csv

        but this fails

        PS C:\> .\Get-UnknownDevices.ps1 -export c:\123.csv

  2. svangulick November 21, 2015 / 8:42 am

    Thanks a lot Stephen! this is defenitly something i’ll be using sooner or later. Great Stuff!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s