2

I need to install a driver on a bunch of systems. (it should have come from MS but we are using kace for patching so i cant use wsus to push it out) So i found this oneliner RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 %path to inf%

Next is to put a check into it so it looks if the driver is installed first but I am having trouble finding the driver. I made an assumption that guidid or class from .inf will provide me with the info i need to check.

[Version]
Signature="$Windows NT$"
Class=SmartCard
ClassGuid={990A2BD7-E738-46c7-B26F-1CF8FB9F1391}
Provider=%ProviderName%
CatalogFile=delta.cat
DriverVer=08/11/2015,8.4.9.0"

Get-WmiObject Win32_PnPSignedDriver -Property * | where {$_.ClassGuid -like 
"990A2BD7-E738-46c7-B26F-1CF8FB9F1391"} 

but I can not find the driver installed. I list all drivers and attempt to scroll through them to find this one and it's not there or it's called something else now.

eventual goal is something like this

if (!(Get-WmiObject Win32_PnPSignedDriver| select devicename, classguid | 
where {$_.classguid -like "*990A2BD7-E738-46c7-B26F-1CF8FB9F1391*"})) {echo 
do stuff} else { echo dont do stuff}

Any help in being able to identify if the driver is installed or not would be appreciated.

2 Answers 2

1

A little googling goes a long way as this has been asked a few times before. Here is a WMIC query against all the installed drivers on the system, then filters out everything except the smartcard class using the classGUID.

Get-WmiObject Win32_PnPSignedDriver| where-object {$_.ClassGUID -eq "{50DD5230-BA8A-11D1-BF5D-0000F805F530}"} |Select *

Here is what got me to my answer if you need additional clarification.
How do I get all the smart card readers on my system via WMI?
https://superuser.com/questions/567927/get-driver-version-via-command-line-windows
https://blogs.technet.microsoft.com/askperf/2012/02/17/useful-wmic-queries/

Sign up to request clarification or add additional context in comments.

3 Comments

If you look at my question it is what i am doing already. If you read further I am saying I can not find the driver that has been loaded. Not "I am not able to search for the driver" but I do not know what criteria to search for because the info in INF does not provide the results expected.
Perhaps you should collect the data before the install, then collect it after the install, then Compare-Object the two lists. Regadless it sounds like this is a "How do I identify a driver" question. Not a powershell question since as you say you understand and have no problem with the powershell.
@user3225054 That command reveals the "DriverVersion" number which is, if its not the driver number you are expecting you should install the driver.
0

I found the following works if you are aware of the driver filename/inf:

Get-WindowsDriver -Online -All | Where {$_.OriginalFileName -like "*zbrn.inf*"}

Returns an object(s) can filter/select on:

Version          : 7.1.7.0
Driver           : oem40.inf
OriginalFileName : C:\Windows\System32\DriverStore\FileRepository\zbrn.inf_amd64_a046310532795a57\zbrn.inf
Inbox            : False
CatalogFile      : ZBRN.cat
ClassName        : Printer
ClassGuid        : {4D36E979-E325-11CE-BFC1-08002BE10318}
ClassDescription : Printers
BootCritical     : False
DriverSignature  : Signed
ProviderName     : ZEBRA
Date             : 02/21/2014 00:00:00
MajorVersion     : 7
MinorVersion     : 1
Build            : 7
Revision         : 0
Path             : 
Online           : True
WinPath          : 
SysDrivePath     : 
RestartNeeded    : False
LogPath          : C:\Windows\Logs\DISM\dism.log
ScratchDirectory : 
LogLevel         : WarningsInfo

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.