Problems with PnPutil.exe in OPSISctipt

Antworten
Tigger
Beiträge: 25
Registriert: 27 Jun 2018, 08:31

Problems with PnPutil.exe in OPSISctipt

Beitrag von Tigger »

Hello community!

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"
                     )



The tool PnPutil.exe is included in the OPSI directory. It is also called. It is not any different if I start the tool from the hard disk of the installed OS.

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
Zuletzt geändert von Tigger am 23 Aug 2018, 15:06, insgesamt 4-mal geändert.
Benutzeravatar
SisterOfMercy
Beiträge: 1522
Registriert: 22 Jun 2012, 19:18

Re: Treiber Installieren oder Updaten

Beitrag von SisterOfMercy »

Tigger hat geschrieben:

Code: Alles auswählen

Set $ProductId$       = "Driver Install"
set $BasePath$ = "%ScriptDrive%\win81-x64\drivers\drivers"
%ScriptDrive%?? Does that exist? That's the thing I was looking for, for my own driver update script. My version uses DPINst.exe
Great stuff, especially that version 2.10, which has been released like, three times. So there is 2.10 from the Windows DDK, 2.10 from the Windows-something-else and the 2.10 from even another Windows-thing-a-me-bob. Fantastic! Why even use version numbers if you're keeping it the same. (bunch of wankers)

I was going to say something about %ScriptDrive% but I seemed to have missed that in the manual. The thing I can say: your ProductId might not be valid.
Template says:

Code: Alles auswählen

;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Tigger
Beiträge: 25
Registriert: 27 Jun 2018, 08:31

Re: Driver Install or update

Beitrag von Tigger »

Hello SisterOfMercy,
%ScriptDrive%?? Does that exist?
Yes still exists and working
Antworten