Utility to Assist in Identifying Plug and Play Drivers
Have you ever tried to get a build created with all the required device drivers, and have found that there are one or two yellow question marks that you cannot find the correct drivers for?
Yes, we've all been there at sometime.
To help me with this situation when new machines, demo or otherwise, arrive at my clients, I have developed a utility which you run on the pre-installed operating system, which records all the Device ID's and the associated driver information. Although this does not guarantee a 100% solution for all situations, being able to identify driver information based on the device ID associated with a yellow question mark in device manager, often leads to a quick solution.
The VBScript code relies on a couple of WMI functions - Win32_PnPEntity and Win32_PnPSignedDriver. It is run from the Windows operating system installed by the manufacturer, which will have all required device drivers installed.
When the code runs, it will ask for a machine name to identify the hardware you are running on. Enter a model name or number - whichever is the most memorable. The resultant file will be saved in the same folder as the script.
Code for PnPEntity.vbs:
Const ForReading = 1, ForWriting = 2
Dim fso, f, input
input = InputBox("Enter the Machine Name", "PNPEntity Grabber Program", "Testfile")
Set fso = CreateObject("Scripting.FileSystemObject")
'Set f = fso.OpenTextFile("D:\WMI Scripts\testfile.txt", ForWriting, True)
'Set f = fso.OpenTextFile("testfile.txt", ForWriting, True)
Set f = fso.OpenTextFile(input&"-PNPEntities.txt", ForWriting, True)
f.WriteLine "PNPEntity scan for model: "&input
f.WriteLine ""
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PnPEntity") '& "WHERE Caption <> 0")
Set infItems = objWMIService.ExecQuery("Select * from Win32_PnPSignedDriver Where InfName <> null")
For Each objItem in colItems
f.WriteLine "Manufacturer: " & objItem.Manufacturer
f.WriteLine "Name: " & objItem.Name
f.WriteLine "Description: " & objItem.Description
f.WriteLine "Class GUID: " & objItem.ClassGuid
f.WriteLine "PNP Device ID: " & objItem.PNPDeviceID
'f.WriteLine "Device ID: " & objItem.DeviceID
For Each Item in infItems
If objItem.DeviceID = Item.DeviceID then
f.WriteLine "Device Class: " & Item.DeviceClass
f.WriteLine "Hardware ID: " & Item.HardwareID
f.WriteLine "Inf Name: " & Item.InfName
End If
Next
f.WriteLine "Service: " & objItem.Service
f.WriteLine ""
Next
' f.WriteLine "**********************************************************************************************************************"
' f.WriteLine "**********************************************************************************************************************"
' f.WriteLine "**********************************************************************************************************************"
' f.WriteLine ""
'For Each Item in infItems
' f.WriteLine "Description: " & Item.Description
' f.WriteLine "Device Class: " & Item.DeviceClass
' f.WriteLine "Device ID: " & Item.DeviceID
' f.WriteLine "Device Name: " & Item.DeviceName
' f.WriteLine "Hardware ID: " & Item.HardwareID
' f.WriteLine "Inf Name: " & Item.InfName
' f.WriteLine ""
'Next
f.close
wscript.echo "Finished"
Very cool. Thanks for
Very cool. Thanks for posting this
Liam Finn
http://www.computerusersolutions.com
http://www.enterprisevaultfaq.com
http://www.plymouthrocklodge47.com
http://www.plymouthrocklodge47.com/masonchat
Very helpful, some related links
For anybody that may be looking for related scripts or utilties... Here are some from microsoft:
http://technet.microsoft.com/en-us/magazine/2006.05.utilityspotlight.aspx
There's also a tool available from sourceforge written by one of the MSFN forums regulars that does a related job, it's called FindHWIDs - it will find all the Hardware IDs in a given set of driver folders and record them to a CSV file for comparison with the output of scripts like the above ones. The author has also written a "Driver Installer" tool called DriverForge that takes a folder (or folder tree) of drivers and installs all of them that apply to the current hardware.
http://sourceforge.net/projects/driverforge/
Hope that's what someone was looking for!
Would you like to reply?
Login or Register to post your comment.