通过命令行安装设备驱动程序

问题描述:

我正在将智能卡部署到我们的环境中,并且制造商提供的驱动程序是3个文件,CAT,DLL和INF。如果我右键单击INF并选择安装它的作品。我需要为SCCM打包,所以我尝试通过命令行进行安装,但每次都会导致安装失败。以下是INF通过命令行安装设备驱动程序

; 
; HID Global Smartcard Minidriver inf for x64 
; 
; 

[Version] 
Signature="$Windows NT$" 
Provider=%VendorName% 
DriverVer=07/12/2007,1.0.0.14 
DriverPackageDisplayName="HID Global Minidriver" 
CatalogFile=hidcrdmx.cat 
Class="Smart Cards" 
ClassGuid={990A2BD7-E738-46c7-B26F-1CF8FB9F1391} 

[Manufacturer] 
%VendorName%=HIDGlobal,NTamd64 

[HIDGlobal.NTamd64] 
%HIDGlobalDeviceName%=HIDGlobal_Install,UMDF\ATR_3BFA1800FF8131FE454A434F5034314332303074 

[DefaultInstall] 
AddReg=Minidriver_RegistryAdd 
[email protected] 
CopyFiles=Syswow64_CopyFiles 


[HIDGlobal_Install] 
[email protected] 
CopyFiles=Syswow64_CopyFiles 

[Syswow64_CopyFiles] 
hidcrdm.dll 

[SourceDisksNames] 
1=%MediaDescription% 

[SourceDisksFiles] 
hidcrdmx.dll=1 
hidcrdm.dll=1 


[Strings] 
VendorName="HID Global" 
MediaDescription="HID Global Smart Card Minidriver Installation Disk" 
CardKey="SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\HID Crescendo C200" 
CardKey64="SOFTWARE\Wow6432Node\Microsoft\Cryptography\Calais\SmartCards\HID Crescendo C200" 
HIDGlobalDeviceName="HID Crescendo C200" 

[Minidriver_RegistryAdd] 
HKLM, %CardKey%,"80000001",0x0,"hidcrdmx.dll" 
HKLM,%CardKey%,ATR,0x00000001,3B,FA,18,00,FF,81,31,FE,45,4A,43,4F,50,34,31,43,32,30,30,74 
HKLM, %CardKey%,ATRMask,0x00000001,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff 
HKLM, %CardKey%,"Crypto Provider",0x0,"Microsoft Base Smart Card Crypto Provider" 
HKLM, %CardKey%,"Smart Card Key Storage Provider",0x0,"Microsoft Smart Card Key Storage Provider" 
HKLM, %CardKey64%,"80000001",0x0,"hidcrdm.dll" 
HKLM, %CardKey64%,ATR,0x00000001,3B,FA,18,00,FF,81,31,FE,45,4A,43,4F,50,34,31,43,32,30,30,74 
HKLM, %CardKey64%,ATRMask,0x00000001,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff 
HKLM, %CardKey64%,"Crypto Provider",0x0,"Microsoft Base Smart Card Crypto Provider" 
HKLM, %CardKey64%,"Smart Card Key Storage Provider",0x0,"Microsoft Smart Card Key Storage Provider" 


[DestinationDirs] 
DefaultDestDir = 11 ; dirid = \system32 on WinNT platforms 
Syswow64_CopyFiles=10,syswow64 ; %windir%\syswow64 on x64 
+0

你能分享一下你在程序中为你的程序包指定了什么。哪些命令/参数?无论您是针对x64还是x86系统,这也很重要。 – Mikhail 2013-03-28 12:36:48

使用dpinst从命令行安装驱动程序。即使您未在环境中使用Windows 8,也可以通过下载Windows 8 SDK来获得此信息。有单独的x64和x86 dpinst可执行文件。这里是dpinst /?输出:

C:\Program Files (x86)\Windows Kits\8.0\redist\DIFx\dpinst\EngMui\x64\dpinst.exe 
: installs and uninstalls driver packages. 
By default, the tool searches the current directory and tries to install all dri 
ver packages found. 

Usage: C:\Program Files (x86)\Windows Kits\8.0\redist\DIFx\dpinst\EngMui\x64\dpi 
nst.exe [/U INF-file][/S | /Q][/LM][/P][/F][/SH][/SA][/A][/PATH Path][/EL][/L La 
nguageID][/C][/D][/LogTitle Title][/SW][/? | /h | /help] 

    /U INF-file Uninstall a driver package (INF-file). 
    /S | /Q  Silent (Quiet) mode. Suppresses the Device Installation Wizard 
and any dialogs popped-up by the operating system. 
    /LM Legacy mode. Accepts unsigned driver packages and packages with missing 
files. These packages won't install on the latest version of Windows. 
    /P  Prompt if the driver package to be installed is not better than the cur 
rent one. 
    /F  Force install if the driver package is not better than the current one. 

    /SH Scans hardware for matching devices and only copies and installs those 
drivers for which a device is present. Only valid for Plug and Play drivers. 
    /SA Suppress the Add/Remove Programs entry normally created for each driver 
package. 
    /A  Install all or none. 
    /PATH Path  Search for driver packages under the given path. 
    /EL Enables all languages not explicitly listed in the XML file. 
    /L LanguageID   Tries to use the given language in all UI. Useful for l 
ocalization tests. 
    /SE Suppress the EULA. 
    /C  Dump logging output to attached Console (Windows XP and above). 
    /D  Delete driver binaries on uninstall. 
    /SW Suppresses the Device Installation Wizard, the operating system might s 
till pop-up user dialogs. 
    /? | /h | /help  Shows this help. 

如果需要安装驱动程序之前安装的发布者证书,可以用certmgr.exe完成,并安装证书到trusted publishers商店。这样,驱动程序安装将不会失败或提示继续,并且它将真正无人值守。

我是在相同的情况下,在我的情况下,dpinst返回代码0x100 “没有找到匹配的设备”

我终于找到了解决方案,使用以下命令行:

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 .\hidcrdmx.inf 

的C200现在已经完全被Windows识别。

+0

我得到了,安装失败 – deFreitas 2016-10-12 20:43:28