User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

When using either Imaging Toolkit or Driver Manager drivers are delivered to a machine as it is being deployed.

Occasionally machines fail to deploy or install all the drivers correctly. The quickest way of reviewing what drivers are missing is to open Device Manager (devmgmt.msc) on the machine and check for unknown devices or those reporting an error.

Where it is not obvious which device to use the Report Issue functionality, for example, the “Base System Device” in the image above, the Hardware IDs can be used in order to work out which device does not have a driver.
This involves displaying the properties for each device with an error, reviewing the Details tab, identifying all the Hardware IDs and searching through the machine XML files to find the matching device.

In order to simplify this process we have created a simple vbscript file that can be executed on a machine to gather information about the devices in error.

The output from the script can then be pasted into the Driver Issue Report in either Build Console or Driver Manager and gives us a lot more information to assist in identifying the missing drivers.

The sample script below logs the information to C:\Unknown-Devices.log.

on error resume next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("Shell.Application")

'Option Explicit

Const ForAppending = 8

' set up logging
Set objLogFile = objFSO.OpenTextFile("c:\Unknown-Devices.log", ForAppending, True)

Dim oWMI, sComputerName, colItems, oItem
sComputerName = "."
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objItem in colItems
objLogfile.WriteLine "====================================================="
objLogfile.WriteLine " Hardware "
strmanufacturer = objItem.Manufacturer
objLogfile.WriteLine " Manufacturer: " & objItem.Manufacturer
objLogfile.WriteLine " Model: " & objItem.Model
objLogfile.WriteLine " Name: " & objItem.Name

if strmanufacturer = "LENOVO" then
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems1 = objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct")
For Each objItem in colItems1
objLogfile.WriteLine " Lenovo Model: " & objItem.Version
End If

Set oWMI = GetObject ("winmgmts:\\.\root\cimv2")
Set colItems = oWMI.ExecQuery ("Select * from Win32_PnPEntity where status = 'error'")
objLogfile.WriteLine "====================================================="
objLogfile.WriteLine " Script ran at " & Time & " on " & Date
objLogfile.WriteLine "====================================================="

For Each oItem In colItems
objLogfile.WriteLine "Name: " & oItem.Name
objLogfile.WriteLine "DeviceID: " & oItem.DeviceID
objLogfile.WriteLine "PNP Device ID: " & oItem.PNPDeviceID
objLogfile.WriteLine "Description: " & oItem.Description
objLogfile.WriteLine "manufacturer: " & oItem.Manufacturer
objLogfile.WriteLine "====================================================="

objLogfile.WriteLine "If missing drivers have been found please paste the content of this file into the Driver Manager / Build Console driver issue report"

wscript.echo "Processing complete. Review c:\Unknown-Devices.log file"