I have written an OPSI script to install or update the drivers. When testing it with wininst.exe as an administrator, it works fine.
If I start the script with the Opsi Agent then opens the CMD window, it also looks like everything would work, but unfortunately it does not work.
Code: Alles auswählen
;Standard Text, shown during installation
Message = Bitte warten, das Produkt wird installiert
;Set Loglevel
setLogLevel = 6
;Stop when errors
ExitOnError = false
;Syntax Fehler are shown in a seperate window
ScriptErrorMessages = on
;Do not use Single-Step Mode
TraceMode = off
;No winst-window in foreground while batchmode
StayOnTop = false
[Actions]
requiredWinstVersion >= "4.11.4"
DefVar $ProductId$
DefVar $ProductName$
DefVar $MinimumSpace$
DefVar $ExitCode$
DefVar $LogDir$
DefVar $InstallDir32$
DefVar $InstallDir64$
Set $LogDir$ = "%SystemDrive%\tmp"
Set $ProductId$ = "Driver Install"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
DefVar $BasePath$
DefVar $SysInfoManufacturer$
DefVar $SysInfoModel
DefVar $DriversPathbyAudit$
DefVar $DriversPathpreferred$
DefVar $pnputim$
set $pnputim$ = "%ScriptPath%\PnPutil.exe"
set $BasePath$ = "%ScriptDrive%\win81-x64\drivers\drivers"
set $SysInfoManufacturer$ = getValue("sysinfo.Manufacturer", getHWBiosInfoMap)
set $SysInfoModel = getValue("sysinfo.Product Name", getHWBiosInfoMap)
;set $SysInfoManufacturer$ = "Intel corporation" ;zu testzwecken enablen und anpassen
;set $SysInfoModel = "NUC6i3SYB" ;zu testzwecken enablen und anpassen
set $DriversPathbyAudit$ = $BasePath$ + "\additional\byAudit\" + $SysInfoManufacturer$ + "\" + $SysInfoModel
set $DriversPathpreferred$ = $BasePath$ + "\preferred"
DosBatch_DriversUpdate
[DosBatch_DriversUpdate]
@echo off
for /R "$DriversPathbyAudit$" %%i in (*.inf) do (
echo Treiberupdate fuer "%%i"
"$pnputim$" -i -a "%%i"
)
for /R "$DriversPathbyAudit$" %%i in (*.cmd) do (
echo Install fuer "%%i"
call "%%i"
)
for /R "$DriversPathpreferred$" %%i in (*.inf) do (
echo Treiberupdate fuer "%%i"
"$pnputim$" -i -a "%%i"
)
for /R "$DriversPathpreferred$" %%i in (*.cmd) do (
echo Install fuer "%%i"
call "%%i"
)
In this context, I have one more question. How can the script determine which OPSI OS package has been installed. Background of the question is that I can also automatically lay down the directory of the OS. At the moment this is hardcoded
And yes the %ScriptDrive% is working.
Greetings Alexander Koch