user3225054
user3225054

Reputation: 70

Verify driver install through powershell

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.

Upvotes: 2

Views: 4908

Answers (2)

PotatoFarmer
PotatoFarmer

Reputation: 2984

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

Upvotes: 0

Nick W.
Nick W.

Reputation: 1614

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/

Upvotes: 1

Related Questions