Here we are, working with SCCM again. Making difficult things possible, and simple things difficult. Today we wish to distribute a SmartCard driver to all of our managed servers, so that we can require Smart Card for certain classes of logins. the newer “CNG” Smart Card minidrivers are all simple “.inf” driver packages that you can right-click install. This ought to be easy, thought the sys admin. Wrong!
Installation of inf drivers is not a well documented command line procedure (unlike the rather more complicated “.msi” package, which at least is easy to script).
My thanks goes out to the following bloggers and forum users for their assistance with this case:
— For documenting the syntax of the “advpack.dll” library.
— For noting appropriate use of the “%~dp0” script variable to specify a batch file script directory.
— For the excellent idea on handling x86/amd64 installation switching from within a batch file.
The script that I cobbled together to install the Athena “ASECard” minidriver is displayed below. Note that this should work for pretty much any minidriver, as long as it has a “DefaultInstall” section in the inf file. I just unpack the amd64 and x86 driver cab files into their respective directories, put the batch script one directory above these, and make an SCCM software package of the whole thing. The installation command line is simply the batch file name.
REM Installs the drivers specified in the "DefaultInstall" section
REM of the aseMD.inf that is appropriate for the current (x86 or amd64) platform.
REM Install is silent (4 flag), with no reboot (N flag).
REM The INF is specified to be in the x86 or amd64 subdirectory
REM of the script directory (%~dp0).
echo Detecting platform…
IF EXIST "%programfiles(x86)%" (GOTO :amd64) ELSE (GOTO :i386)
echo Installing 32-bit driver…
%windir%system32rundll32.exe advpack.dll,LaunchINFSectionEx "%~dp0x86aseMD.inf",DefaultInstall,,4,N
REM The command will run in 64-bit mode (%windir%sysnative),
REM when called from a 32-bit CMD.exe (as will be the case with SCCM).
echo Installing 64-bit driver…
%windir%sysnativerundll32.exe advpack.dll,LaunchINFSectionEx "%~dp0amd64aseMD.inf",DefaultInstall,,4,N
REM End of file