[GELÖST] Win10 - Druckertreiber - Installationsproblem wg. Berechtigung

WSler
Beiträge: 11
Registriert: 28 Okt 2015, 13:42

[GELÖST] Win10 - Druckertreiber - Installationsproblem wg. Berechtigung

Beitrag von WSler »

Hallo Opsi-Gemeinde,

Nachdem ich nun ein knappes Jahr mit den vorhandenen Threads und Hilfen ausgekommen bin, stehe ich nun kurz vor dem Exitus :?

Ich habe folgendes Problem:
Meine Aufgabe ist es, den Opsi für Windows 10 vorzubereiten. Damit bin ich auch weitestgehend fertig. Jedoch bastel ich jetzt schon seid knapp einer Woche an unseren Druckerinstallations-scripts.

Unser Opsi wurde vor kurzem auf den aktuellsten Stand gebracht (Linux 14.04) und

Code: Alles auswählen

dpkg -l |grep opsi
ii  opsi-atftpd                      0.7.dfsg-5                           amd64        advanced TFTP server - opsi version with pcre, fifo and max-blksize patches
ii  opsi-configed                    4.0.6.3.5.1-2                        all          OPSI config editor
ii  opsi-depotserver                 4.0.6.4-1                            all          opsi depotserver configuration package
ii  opsi-linux-bootimage             20150916-2                           amd64        opsi bootimage for netboot tasks.
ii  opsi-utils                       4.0.6.8-1                            all          utilites for working with opsi.
ii  opsiconfd                        4.0.6.10-7                           all          opsi configuration service
ii  opsipxeconfd                     4.0.5.5-2                            all          opsi pxe configuration daemon
ii  python-opsi                      4.0.6.28-1                           all          opsi python library
Das Script sieht aktuell (nach ein paar Anpassungen für W10) so aus:

Code: Alles auswählen

;==================================================================================================================================================================================================================
[actions]
DefVar $msversion$
DefVar $Name_Drucker$
DefVar $Typ_Drucker$
DefVar $IP_Drucker$
DefVar $Port_Drucker$
DefVar $Driverpath_Drucker$
DefVar $Driverpath_Drucker_Reg$
DefVar $IP_Computer$
DefVar $SystemType$
DefVar $Installpath$

set $msversion$ = GetMsVersionInfo
Set $Name_Drucker$ = "Kyocera TASKalfa 250ci KX EMPFANG"
Set $Typ_Drucker$ ="Kyocera TASKalfa 250ci KX"
Set $IP_Drucker$ = "10.0.0.55"
Set $Port_Drucker$ = "9100"
Set $IP_Computer$ = "%PCName%"
Set $SystemType$	= GetSystemType
;==================================================================================================================================================================================================================
;Installiertes Betriebssystem ueberpruefen
if CompareDotSeparatedNumbers($msversion$,"5.2") < "0.1"
	comment "Installiertes OS: WindowsXP"
	comment "Dieses Betriebssystem wird nicht mehr unterstützt!"
	isFatalError
;---------------------------------------------------------------------------------
;--	Hier wurde früher Windows XP Treiber installiert -> nicht mehr benötigt     --
;--	Set $Driverpath_Drucker$ = "%ScriptPath%\32bit\XP and newer\OEMSETUP.INF"   --
;--	Set $Driverpath_Drucker_Reg$ = "%ScriptPath%\32bit\xp-32.reg"               --
;---------------------------------------------------------------------------------
else
	if CompareDotSeparatedNumbers($msversion$,"6.2") < "0.1"
		comment "Installiertes OS: Windows7"
		Set $Driverpath_Drucker$ = "%ScriptPath%\64bit\Win10\OEMSETUP.INF"
	else 
		if CompareDotSeparatedNumbers($msversion$,"10.1") < "0.1"
			comment "Installiertes OS: Windows 10"
			Set $Driverpath_Drucker$ = "%ScriptPath%\64bit\Win10\OEMSETUP.INF"
		else
			comment "Dieses Betriebssystem wird leider nicht unterstützt."
			isFatalError
		endif
	endif
endif

;==================================================================================================================================================================================================================
Registry_install_Printport
winbatch_restart_spool
winbatch_install_Printer
if CompareDotSeparatedNumbers($msversion$,"6.2") < "0.1" or CompareDotSeparatedNumbers($msversion$,"10.1") < "0.1"
	Set $Driverpath_Drucker_Reg$ = "%ScriptPath%\64bit\schwarz1-w7x64.reg"
	winbatch_import_options
	Set $Driverpath_Drucker_Reg$ = "%ScriptPath%\64bit\schwarz2-w7x64.reg"
	winbatch_import_options
	Set $Driverpath_Drucker_Reg$ = "%ScriptPath%\64bit\schwarz3-w7x64.reg"
	winbatch_import_options
endif
DosInAnIcon_set_rights
;==================================================================================================================================================================================================================
[Registry_install_Printport]
OpenKey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\$IP_Drucker$]
Add "Protocol" = REG_DWORD:00000001
Add "Version" = REG_DWORD:00000001
Add "HostName" = "$IP_Drucker$"
Add "IPAddress" = "$IP_Drucker$"
Add "HWAddress" = ""
Add "PortNumber" = REG_DWORD:$Port_Drucker$
Add "SNMP Community" = "public"
Add "SNMP Enabled" = REG_DWORD:00000001
Add "SNMP Index" = REG_DWORD:00000001

[winbatch_install_Printer]
rundll32 printui.dll,PrintUIEntry /dl /n "$Name_Drucker$" /q
printui.exe /ia /m "$Typ_Drucker$" /h "x64" /v "Type 3 - User Mode" /f "$Driverpath_Drucker$" /u
rundll32 printui.dll,PrintUIEntry /if /b "$Name_Drucker$" /f "$Driverpath_Drucker$" /r "$IP_Drucker$" /m "$Typ_Drucker$" /z /u 

[winbatch_import_options]
regedit.exe /s $Driverpath_Drucker_Reg$

[winbatch_restart_spool]
net.exe stop Spooler
net.exe start Spooler

[DosInAnIcon_set_rights]
%ScriptPath%\prg\setacl -on "\\$IP_Computer$\$Name_Drucker$" -ot prn -actn ace -ace "n:Jeder;p:full"
Führe ich das Script über die Winst32.exe lokal auf einer W10 Testmöhre aus, läuft es durch und der Treiber wird installiert.
Nun schiebe ich das ganze in den Opsi, paketiere es und feuer ein on_demand auf einen "nackigen" Testclient raus...
An dem Punkt, an dem der Treiber installiert wird, bleibt der ganze Spaß stehen und es geht nicht weiter.
Das ist an der Sektion [Winbatch_install_Printer]

Die log bis hierher sieht dann so aus:

Code: Alles auswählen

[6] [Okt 28 14:43:16:974] [printer_kyocera_250] Actionrequest for Product: printer_kyocera_250 is: setup
[6] [Okt 28 14:43:16:975] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc getProductProperties_hash
[6] [Okt 28 14:43:17:155] [printer_kyocera_250] JSON Bench for getProductProperties_hash "params":["printer_kyocera_250","wm01-044.w-s.lan" Start: 14:43:16:975 Time: 00:00:00:180
[6] [Okt 28 14:43:17:216] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc getProduct_hash
[6] [Okt 28 14:43:17:349] [printer_kyocera_250] JSON Bench for getProduct_hash "params":["printer_kyocera_250","sv00-170.w-s.lan" Start: 14:43:17:216 Time: 00:00:00:133
[6] [Okt 28 14:43:17:411] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc productOnClient_getObjects
[6] [Okt 28 14:43:17:478] [printer_kyocera_250] JSON Bench for productOnClient_getObjects "params":["",{"clientId":"wm01-044.w-s.lan","produ Start: 14:43:17:411 Time: 00:00:00:067
[5] [Okt 28 14:43:17:541] [printer_kyocera_250] scriptname: "setup.ins", special path: "p:\printer_kyocera_250\"
[6] [Okt 28 14:43:17:541] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc productOnClient_updateObject
[6] [Okt 28 14:43:17:677] [printer_kyocera_250] JSON Bench for productOnClient_updateObject "params":[{"clientId":"wm01-044.w-s.lan","actionRe Start: 14:43:17:541 Time: 00:00:00:136
[1] [Okt 28 14:43:17:762] [printer_kyocera_250] 
[1] [Okt 28 14:43:17:762] [printer_kyocera_250] ============ Version 4.11.5.14 script "p:\printer_kyocera_250\setup.ins"
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              used script encoding: cp1252
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              used system encoding: cp1252
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              start: 2015-10-28  14:43:17 
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              installing product: printer_kyocera_250_1.0-6
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              on client named    "wm01-044.w-s.lan"
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              loggedin user    ""
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              opsi-script running as    "SYSTEM"
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              opsi-script running with admin privileges
[1] [Okt 28 14:43:17:762] [printer_kyocera_250]              opsi-script running in standard script mode
[1] [Okt 28 14:43:17:762] [printer_kyocera_250] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Okt 28 14:43:17:762] [printer_kyocera_250] system infos:
[1] [Okt 28 14:43:17:763] [printer_kyocera_250] 1C-6F-65-92-C2-5C  -  PC hardware address
[1] [Okt 28 14:43:17:763] [printer_kyocera_250] WM01-044.w-s.lan  -  IP name 
[1] [Okt 28 14:43:17:763] [printer_kyocera_250] 10.0.1.44  -  IP address
[1] [Okt 28 14:43:17:763] [printer_kyocera_250] DEU  -  System default locale 
[1] [Okt 28 14:43:17:763] [printer_kyocera_250] MS Windows 10.0 64 Bit
[1] [Okt 28 14:43:17:763] [printer_kyocera_250] opsi service version : 4
[1] [Okt 28 14:43:17:763] [printer_kyocera_250] 
[6] [Okt 28 14:43:17:763] [printer_kyocera_250] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [Okt 28 14:43:17:763] [printer_kyocera_250] Key closed
[5] [Okt 28 14:43:17:830] [printer_kyocera_250] Set  $msversion$ = GetMsVersionInfo
[6] [Okt 28 14:43:17:830] [printer_kyocera_250]   The value of the variable "$msversion$" is now: "10.0"
[5] [Okt 28 14:43:17:830] [printer_kyocera_250] Set  $Name_Drucker$ = "Kyocera TASKalfa 250ci KX EMPFANG"
[6] [Okt 28 14:43:17:830] [printer_kyocera_250]   The value of the variable "$Name_Drucker$" is now: "Kyocera TASKalfa 250ci KX EMPFANG"
[5] [Okt 28 14:43:17:830] [printer_kyocera_250] Set  $Typ_Drucker$ ="Kyocera TASKalfa 250ci KX"
[6] [Okt 28 14:43:17:830] [printer_kyocera_250]   The value of the variable "$Typ_Drucker$" is now: "Kyocera TASKalfa 250ci KX"
[5] [Okt 28 14:43:17:830] [printer_kyocera_250] Set  $IP_Drucker$ = "10.0.0.55"
[6] [Okt 28 14:43:17:830] [printer_kyocera_250]   The value of the variable "$IP_Drucker$" is now: "10.0.0.55"
[5] [Okt 28 14:43:17:830] [printer_kyocera_250] Set  $Port_Drucker$ = "9100"
[6] [Okt 28 14:43:17:830] [printer_kyocera_250]   The value of the variable "$Port_Drucker$" is now: "9100"
[5] [Okt 28 14:43:17:830] [printer_kyocera_250] Set  $IP_Computer$ = "WM01-044"
[6] [Okt 28 14:43:17:830] [printer_kyocera_250]   The value of the variable "$IP_Computer$" is now: "WM01-044"
[5] [Okt 28 14:43:17:830] [printer_kyocera_250] Set  $SystemType$	= GetSystemType
[6] [Okt 28 14:43:17:830] [printer_kyocera_250]   The value of the variable "$SystemType$" is now: "64 Bit System"
[6] [Okt 28 14:43:17:830] [printer_kyocera_250] If
[5] [Okt 28 14:43:17:830] [printer_kyocera_250]   CompareDotSeparatedNumbers($msversion$,"5.2") < "0.1"   <<< result false
[6] [Okt 28 14:43:17:830] [printer_kyocera_250] Then
[6] [Okt 28 14:43:17:831] [printer_kyocera_250] Else
[6] [Okt 28 14:43:17:831] [printer_kyocera_250]   If
[5] [Okt 28 14:43:17:831] [printer_kyocera_250]     CompareDotSeparatedNumbers($msversion$,"6.2") < "0.1"   <<< result false
[6] [Okt 28 14:43:17:831] [printer_kyocera_250]   Then
[6] [Okt 28 14:43:17:831] [printer_kyocera_250]   Else
[6] [Okt 28 14:43:17:831] [printer_kyocera_250]     If
[5] [Okt 28 14:43:17:831] [printer_kyocera_250]       CompareDotSeparatedNumbers($msversion$,"10.1") < "0.1"   <<< result true
[6] [Okt 28 14:43:17:831] [printer_kyocera_250]     Then
[5] [Okt 28 14:43:17:831] [printer_kyocera_250]       comment: Installiertes OS: Windows 10
[5] [Okt 28 14:43:17:831] [printer_kyocera_250] 
[5] [Okt 28 14:43:17:831] [printer_kyocera_250] DOSBatch_copy
[6] [Okt 28 14:43:17:831] [printer_kyocera_250]   c:\opsi.org\tmp\_opsiscript_Km23Eb24.cmd saved back
[6] [Okt 28 14:43:17:832] [printer_kyocera_250]   Executing "cmd.exe" /C c:\opsi.org\tmp\_opsiscript_Km23Eb24.cmd
[6] [Okt 28 14:43:39:461] [printer_kyocera_250]   ExitCode 0
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]   Delete "c:\opsi.org\tmp\_opsiscript_*"
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]     Search "c:\opsi.org\tmp\"
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]     Search "c:\opsi.org\tmp\_opsiscript_*"
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]     File "c:\opsi.org\tmp\_opsiscript_Hd86Fv85.cmd"
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]       The file is 1 day(s) old, no deletion
[5] [Okt 28 14:43:39:463] [printer_kyocera_250]   Set  $Driverpath_Drucker$ = "C:\tmp\64bit\Win10\OEMSETUP.INF"
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]     The value of the variable "$Driverpath_Drucker$" is now: "C:\tmp\64bit\Win10\OEMSETUP.INF"
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]     Else
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]     EndIf
[6] [Okt 28 14:43:39:463] [printer_kyocera_250]   EndIf
[6] [Okt 28 14:43:39:463] [printer_kyocera_250] EndIf
[5] [Okt 28 14:43:39:464] [printer_kyocera_250] 
[5] [Okt 28 14:43:39:464] [printer_kyocera_250] Execution of Registry_install_Printport
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]   Registry key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\10.0.0.55]  opened
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable Protocol exists,  no overwrite. (The value is "1")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable Version exists,  no overwrite. (The value is "1")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable HostName exists,  no overwrite. (The value is "10.0.0.55")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable IPAddress exists,  no overwrite. (The value is "10.0.0.55")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable HWAddress exists,  no overwrite. (The value is "")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable PortNumber exists,  no overwrite. (The value is "9100")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable SNMP Community exists,  no overwrite. (The value is "public")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable SNMP Enabled exists,  no overwrite. (The value is "1")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Info: Variable SNMP Index exists,  no overwrite. (The value is "1")
[6] [Okt 28 14:43:39:464] [printer_kyocera_250]                 Key closed
[5] [Okt 28 14:43:39:465] [printer_kyocera_250] 
[5] [Okt 28 14:43:39:465] [printer_kyocera_250] Execution of winbatch_restart_spool
[6] [Okt 28 14:43:39:465] [printer_kyocera_250]   Call "net.exe stop Spooler"
[6] [Okt 28 14:43:39:465] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 28 14:43:39:465] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 28 14:43:42:478] [printer_kyocera_250]   ExitCode 0    Executed process "net.exe stop Spooler"
[6] [Okt 28 14:43:42:478] [printer_kyocera_250]   Call "net.exe start Spooler"
[6] [Okt 28 14:43:42:478] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 28 14:43:42:478] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 28 14:43:45:490] [printer_kyocera_250]   ExitCode 0    Executed process "net.exe start Spooler"
[5] [Okt 28 14:43:45:492] [printer_kyocera_250] 
[5] [Okt 28 14:43:45:492] [printer_kyocera_250] Execution of winbatch_install_Printer
[6] [Okt 28 14:43:45:493] [printer_kyocera_250]   Call "rundll32 printui.dll,PrintUIEntry /dl /n "Kyocera TASKalfa 250ci KX EMPFANG" /q"
[6] [Okt 28 14:43:45:493] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 28 14:43:45:493] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 28 14:43:46:524] [printer_kyocera_250]   ExitCode 0    Executed process "rundll32 printui.dll,PrintUIEntry /dl /n "Kyocera TASKalfa 250ci KX EMPFANG" /q"
[6] [Okt 28 14:43:46:525] [printer_kyocera_250]   Call "printui.exe /ia /m "Kyocera TASKalfa 250ci KX" /h "x64" /v "Type 3 - User Mode" /f "C:\tmp\64bit\Win10\OEMSETUP.INF" /u"
[6] [Okt 28 14:43:46:525] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 28 14:43:46:525] [printer_kyocera_250]   Start process as invoker: SYSTEM
...
Es ist also klar, dass es an der Treiberinstallation scheitert.

Code: Alles auswählen

[winbatch_install_Printer]
rundll32 printui.dll,PrintUIEntry /dl /n "$Name_Drucker$" /q
printui.exe /ia /m "$Typ_Drucker$" /h "x64" /v "Type 3 - User Mode" /f "$Driverpath_Drucker$" /u
rundll32 printui.dll,PrintUIEntry /if /b "$Name_Drucker$" /f "$Driverpath_Drucker$" /r "$IP_Drucker$" /m "$Typ_Drucker$" /z /u 
Ich sehe nur leider nicht, warum das so ist. Ich befürchte, mich ein wenig verrannt zu haben :cry:

Ich hoffe, dass ich alle Informationen gegeben habe, die gebraucht werden und natürlich auch, dass jemand eine Lösung oder einen Ansatz weiß.

Bis dahin schonmal vielen Dank für das tolle Forum :)

Mit freundlichen Grüßen
WSler
Zuletzt geändert von WSler am 03 Nov 2015, 15:48, insgesamt 1-mal geändert.
larsg
Beiträge: 283
Registriert: 16 Dez 2014, 18:06

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von larsg »

Ich vermute mal winst hat ein Problem mit dem Aufruf von printui.exe, möglicherweise kommt eine Eingabeaufforderung die winst so nicht bedienen kann.

Der Aufruf via rundll32 scheint ja zu funktionieren -> ersetze testweise mal "printui.exe" mit "rundll32 printui.dll,PrintUIEntry"

Ansonsten,
Was sagt der Tastmanager auf dem Client?
Arbeitet der laufende Prozess noch?
(Tipp: das Tool ProcessExplorer von Sysinternals vereinfacht die Suche nach den entpsrechenden Prozessen extrem)
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von SisterOfMercy »

I use this to install a virtual FreePDF printer with the pdf24 printdriver (for various large formats). I remember messing with registry entries, but that it was not working very well. Storing printer preferences in a .dat file works ok, so you might want to look into that.

Code: Alles auswählen

; Create printer
"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /if /b "FreePDF" /r "freepdfxp1:" /m "PDF24" /z /f "%ScriptPath%\files\printer_nt6\pdf24.inf"

; Restore settings
"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Sr /n "FreePDF" /a "%ScriptPath%\files\printer_nt6\settings.dat" d g r

; Set description and location
"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "FreePDF" comment "PDF Printer"
"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "FreePDF" location "Virtual"
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
edvbuo
Beiträge: 32
Registriert: 02 Jun 2014, 14:49

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von edvbuo »

Ich habe ein Relativ einfaches Druckerscript, was bei uns schon lange sehr gut funktioniert.

Struktur:
Treiber liegen in CLIENT_DATA/files/DRUCKER

CLIENT_DATA/drucker.ins:

Code: Alles auswählen

[Initial]
Message=installiere drucker...
ExitOnError=false
ScriptErrorMessages=on
TraceMode=off

[Actions]
requiredWinstVersion >= "4.11.3.11"

DefVar $ProductId$
Set $ProductId$ = "drucker"

DefVar $DruckerName$
DefVar $DruckerTyp$
DefVar $DruckerIP$
DefVar $DruckerBeschreibung$
DefVar $DruckerPfad$

if ( GetOS = "Windows_NT")
	; - - - - - - - - - - - - - - - - - - - - - - -
	; -   show product picture                    -
	; - - - - - - - - - - - - - - - - - - - - - - -
	ShowBitmap /3 "%scriptpath%\"+$ProductId$+".bmp" $ProductId$
	
	set $DruckerName$ = IniVar('drucker_name')
	set $DruckerTyp$ = IniVar('drucker_type')
	set $DruckerIP$ = IniVar('drucker_ip')

	comment "=== Product properties ================================="
	comment " $DruckerName$ = " + $DruckerName$
	comment " $DruckerTyp$      = " + $DruckerTyp$
	comment " $DruckerIP$   = " + $DruckerIP$
	comment "========================================================"
	
	; - - - - - - - - - - - - - - - - - - - - - - -
	; -   Dell 2330
	; - - - - - - - - - - - - - - - - - - - - - - -
	if $DruckerTyp$ = "Dell2330"
		set $DruckerBeschreibung$ = "Dell 2330dn Laser Printer XL"
		set $DruckerPfad$ = "%ScriptPath%\files\Dell\2330_2350\DKACHC40.inf"
	endif
	
	; - - - - - - - - - - - - - - - - - - - - - - -
	; -   Dell 2350
	; - - - - - - - - - - - - - - - - - - - - - - -
	if $DruckerTyp$ = "Dell2350"
		set $DruckerBeschreibung$ = "Dell 2350d Laser Printer XL"
		set $DruckerPfad$ = "%ScriptPath%\files\Dell\2330_2350\DKACHC40.inf"
	endif
	
	; - - - - - - - - - - - - - - - - - - - - - - -
	; -   Dell 3100 Win7 64BIT
	; - - - - - - - - - - - - - - - - - - - - - - -
	if $DruckerTyp$ = "Dell3100_64bit"
		set $DruckerBeschreibung$ = "Dell Laser Printer 3100cn PCL6"
		set $DruckerPfad$ = "%ScriptPath%\files\Dell\3100\Windows-7\64bit\German\dlxbrzi.inf"
	endif
	
	; - - - - - - - - - - - - - - - - - - - - - - -
	; -   Dell 3100 XP_VISTA
	; - - - - - - - - - - - - - - - - - - - - - - -
	if $DruckerTyp$ = "Dell3100_XP_VISTA"
		set $DruckerBeschreibung$ = "Dell Laser Printer 3100cn PCL6"
		set $DruckerPfad$ = "%ScriptPath%\files\Dell\3100\Windows_XP_Vista\dlxbrzi.inf"
	endif
	
	; - - - - - - - - - - - - - - - - - - - - - - -
	; -   Dell 3115
	; - - - - - - - - - - - - - - - - - - - - - - -
	if $DruckerTyp$ = "Dell3115"
		set $DruckerBeschreibung$ = "Dell MFP Laser 3115cn PCL6"
		set $DruckerPfad$ = "%ScriptPath%\files\Dell\3115\dlxbazi.inf"
	endif
	
	; - - - - - - - - - - - - - - - - - - - - - - -
	; -   Lexmark C734
	; - - - - - - - - - - - - - - - - - - - - - - -
	if $DruckerTyp$ = "LexmarkC734"
		set $DruckerBeschreibung$ = "Lexmark C734 XL"
		set $DruckerPfad$ = "%ScriptPath%\files\Lexmark\C734\LMACCC40.inf"
	endif
	
	DosBatch_printer

endif

[DosBatch_printer]
@echo off
cls
:start

echo.

echo "IP-Anschluss ($DruckerIP$) wird installiert"
cscript %WINDIR%\System32\Printing_Admin_Scripts\de-DE\Prnport.vbs -a -r IP_$DruckerIP$: -h $DruckerIP$ -o raw -n 9100

echo "Druckertreiber $DruckerName$ wird installiert"
%windir%\System32\rundll32.exe printui.dll,PrintUIEntry /if /b "$DruckerName$" /f "$DruckerPfad$" /r "IP_$DruckerIP$:" /m "$DruckerBeschreibung$" /v "Windows 2000 oder XP" /q 
OPSI/control

Code: Alles auswählen

[Package]
version: 1
depends:
incremental: False

[Product]
type: localboot
id: drucker
name: Drucker Installation
description: Installiert auf dem Client verfuegbare TCP-Drucker
advice:
version: 1.1
priority: 0
licenseRequired: False
productClasses: 
setupScript: drucker.ins
uninstallScript: 
updateScript: 
alwaysScript: 
onceScript: 

[ProductProperty]
name: drucker_name
description: Druckername des Druckers (z.b. EDV)
default: EDV

[ProductProperty]
name: drucker_type
description: Welches Modell soll eingerichtet werden?
multivalue: False
values: Dell2330,Dell2350,Dell3100_64bit,Dell3100_XP_VISTA,Dell3115,LexmarkC734
default: Dell3100

[ProductProperty]
name: drucker_ip
description: Geben Sie die IP des Druckers an
default: false
Ist qualitativ nicht das beste aber vielleicht hilft es dem einen oder anderen :-)

Beste Grüße
Niels
WSler
Beiträge: 11
Registriert: 28 Okt 2015, 13:42

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von WSler »

Hallo zusammen und vielen Dank für die konstruktiven Antworten.

@Larsg
ersetze testweise mal "printui.exe" mit "rundll32 printui.dll,PrintUIEntry"
:oops: :oops: Da hätte ich auch drauf kommen können, das mal zu probieren... hat aber leider nicht geholfen :(
Auf dem Client ist auf jeden Fall noch der Opsi-Client aktiv zu sehen und auch im Taskmanager läuft der gute Knabe schön weiter...

@SisterofMercy
Ich habe deinen Code mal soweit umgebaut, dass er in mein Skript passt und auch das laufen lassen...

Code: Alles auswählen

"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /if /b "$Name_Drucker$" /r "$IP_Drucker$" /m "$Typ_Drucker$" /z /f "$Driverpath_Drucker$"
"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Sr /n "$Name_Drucker$" /a "%ScriptPath%\prg\file.dat"
"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "$Name_Drucker$" comment "$Typ_Drucker$"
"%SystemRoot%\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "$Name_Drucker$" location "$Typ_Drucker$"
Jetzt läuft das Script zumindest nicht mehr unendlich durch und steht am Ende auch auf Success...
Soweit sehr erfreulich :) Einziges Problem dabei: Auch nach mehrmaligen reboots des Clients ist weit und breit kein Drucker zu sehen :(

Dabei sieht die Log bis zum setzen der ACL ganz gut aus :

Code: Alles auswählen

[6] [Okt 30 11:51:39:911] [printer_kyocera_250] Actionrequest for Product: printer_kyocera_250 is: setup
[6] [Okt 30 11:51:39:911] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc getProductProperties_hash
[6] [Okt 30 11:51:40:087] [printer_kyocera_250] JSON Bench for getProductProperties_hash "params":["printer_kyocera_250","wm01-044.w-s.lan" Start: 11:51:39:911 Time: 00:00:00:176
[6] [Okt 30 11:51:40:161] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc getProduct_hash
[6] [Okt 30 11:51:40:262] [printer_kyocera_250] JSON Bench for getProduct_hash "params":["printer_kyocera_250","sv00-170.w-s.lan" Start: 11:51:40:160 Time: 00:00:00:102
[6] [Okt 30 11:51:40:336] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc productOnClient_getObjects
[6] [Okt 30 11:51:40:437] [printer_kyocera_250] JSON Bench for productOnClient_getObjects "params":["",{"clientId":"wm01-044.w-s.lan","produ Start: 11:51:40:336 Time: 00:00:00:101
[5] [Okt 30 11:51:40:513] [printer_kyocera_250] scriptname: "setup.ins", special path: "p:\printer_kyocera_250\"
[6] [Okt 30 11:51:40:514] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc productOnClient_updateObject
[6] [Okt 30 11:51:40:596] [printer_kyocera_250] JSON Bench for productOnClient_updateObject "params":[{"clientId":"wm01-044.w-s.lan","actionRe Start: 11:51:40:514 Time: 00:00:00:082
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] 
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] ============ Version 4.11.5.14 script "p:\printer_kyocera_250\setup.ins"
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              used script encoding: cp1252
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              used system encoding: cp1252
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              start: 2015-10-30  11:51:40 
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              installing product: printer_kyocera_250_1.0-6
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              on client named    "wm01-044.w-s.lan"
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              loggedin user    ""
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              opsi-script running as    "SYSTEM"
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              opsi-script running with admin privileges
[1] [Okt 30 11:51:40:687] [printer_kyocera_250]              opsi-script running in standard script mode
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] system infos:
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] 1C-6F-65-92-C2-5C  -  PC hardware address
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] WM01-044.w-s.lan  -  IP name 
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] 10.0.1.44  -  IP address
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] DEU  -  System default locale 
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] MS Windows 10.0 64 Bit
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] opsi service version : 4
[1] [Okt 30 11:51:40:687] [printer_kyocera_250] 
[6] [Okt 30 11:51:40:687] [printer_kyocera_250] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [Okt 30 11:51:40:687] [printer_kyocera_250] Key closed
[5] [Okt 30 11:51:40:756] [printer_kyocera_250] Set  $msversion$ = GetMsVersionInfo
[6] [Okt 30 11:51:40:756] [printer_kyocera_250]   The value of the variable "$msversion$" is now: "10.0"
[5] [Okt 30 11:51:40:756] [printer_kyocera_250] Set  $Name_Drucker$ = "Kyocera TASKalfa 250ci KX EMPFANG"
[6] [Okt 30 11:51:40:756] [printer_kyocera_250]   The value of the variable "$Name_Drucker$" is now: "Kyocera TASKalfa 250ci KX EMPFANG"
[5] [Okt 30 11:51:40:756] [printer_kyocera_250] Set  $Typ_Drucker$ ="Kyocera TASKalfa 250ci KX"
[6] [Okt 30 11:51:40:756] [printer_kyocera_250]   The value of the variable "$Typ_Drucker$" is now: "Kyocera TASKalfa 250ci KX"
[5] [Okt 30 11:51:40:756] [printer_kyocera_250] Set  $IP_Drucker$ = "10.0.0.55"
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   The value of the variable "$IP_Drucker$" is now: "10.0.0.55"
[5] [Okt 30 11:51:40:757] [printer_kyocera_250] Set  $Port_Drucker$ = "9100"
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   The value of the variable "$Port_Drucker$" is now: "9100"
[5] [Okt 30 11:51:40:757] [printer_kyocera_250] Set  $IP_Computer$ = "WM01-044"
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   The value of the variable "$IP_Computer$" is now: "WM01-044"
[5] [Okt 30 11:51:40:757] [printer_kyocera_250] Set  $SystemType$	= GetSystemType
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   The value of the variable "$SystemType$" is now: "64 Bit System"
[6] [Okt 30 11:51:40:757] [printer_kyocera_250] If
[5] [Okt 30 11:51:40:757] [printer_kyocera_250]   CompareDotSeparatedNumbers($msversion$,"5.2") < "0.1"   <<< result false
[6] [Okt 30 11:51:40:757] [printer_kyocera_250] Then
[6] [Okt 30 11:51:40:757] [printer_kyocera_250] Else
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   If
[5] [Okt 30 11:51:40:757] [printer_kyocera_250]     CompareDotSeparatedNumbers($msversion$,"6.2") < "0.1"   <<< result false
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   Then
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   Else
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]     If
[5] [Okt 30 11:51:40:757] [printer_kyocera_250]       CompareDotSeparatedNumbers($msversion$,"10.1") < "0.1"   <<< result true
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]     Then
[5] [Okt 30 11:51:40:757] [printer_kyocera_250]       comment: Installiertes OS: Windows 10
[5] [Okt 30 11:51:40:757] [printer_kyocera_250]       Set  $Driverpath_Drucker$ = "p:\printer_kyocera_250\64bit\Win10\OEMSETUP.INF"
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]         The value of the variable "$Driverpath_Drucker$" is now: "p:\printer_kyocera_250\64bit\Win10\OEMSETUP.INF"
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]     Else
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]     EndIf
[6] [Okt 30 11:51:40:757] [printer_kyocera_250]   EndIf
[6] [Okt 30 11:51:40:757] [printer_kyocera_250] EndIf
[5] [Okt 30 11:51:40:758] [printer_kyocera_250] 
[5] [Okt 30 11:51:40:758] [printer_kyocera_250] Execution of Registry_install_Printport
[6] [Okt 30 11:51:40:758] [printer_kyocera_250]   Registry key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\10.0.0.55]  opened
[6] [Okt 30 11:51:40:758] [printer_kyocera_250]                 Info: Variable Protocol exists,  no overwrite. (The value is "1")
[6] [Okt 30 11:51:40:758] [printer_kyocera_250]                 Info: Variable Version exists,  no overwrite. (The value is "1")
[6] [Okt 30 11:51:40:758] [printer_kyocera_250]                 Info: Variable HostName exists,  no overwrite. (The value is "10.0.0.55")
[6] [Okt 30 11:51:40:758] [printer_kyocera_250]                 Info: Variable IPAddress exists,  no overwrite. (The value is "10.0.0.55")
[6] [Okt 30 11:51:40:758] [printer_kyocera_250]                 Info: Variable HWAddress exists,  no overwrite. (The value is "")
[6] [Okt 30 11:51:40:758] [printer_kyocera_250]                 Info: Variable PortNumber exists,  no overwrite. (The value is "9100")
[6] [Okt 30 11:51:40:759] [printer_kyocera_250]                 Info: Variable SNMP Community exists,  no overwrite. (The value is "public")
[6] [Okt 30 11:51:40:759] [printer_kyocera_250]                 Info: Variable SNMP Enabled exists,  no overwrite. (The value is "1")
[6] [Okt 30 11:51:40:759] [printer_kyocera_250]                 Info: Variable SNMP Index exists,  no overwrite. (The value is "1")
[6] [Okt 30 11:51:40:759] [printer_kyocera_250]                 Key closed
[5] [Okt 30 11:51:40:759] [printer_kyocera_250] 
[5] [Okt 30 11:51:40:759] [printer_kyocera_250] Execution of winbatch_restart_spool
[6] [Okt 30 11:51:40:759] [printer_kyocera_250]   Call "net.exe stop Spooler"
[6] [Okt 30 11:51:40:759] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 30 11:51:40:759] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 30 11:51:43:775] [printer_kyocera_250]   ExitCode 0    Executed process "net.exe stop Spooler"
[6] [Okt 30 11:51:43:775] [printer_kyocera_250]   Call "net.exe start Spooler"
[6] [Okt 30 11:51:43:775] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 30 11:51:43:775] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 30 11:51:46:794] [printer_kyocera_250]   ExitCode 0    Executed process "net.exe start Spooler"
[5] [Okt 30 11:51:46:798] [printer_kyocera_250] 
[5] [Okt 30 11:51:46:798] [printer_kyocera_250] Execution of winbatch_install_Printer
[6] [Okt 30 11:51:46:799] [printer_kyocera_250]   Call "rundll32 printui.dll,PrintUIEntry /dl /n "Kyocera TASKalfa 250ci KX EMPFANG" /q"
[6] [Okt 30 11:51:46:799] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 30 11:51:46:799] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 30 11:51:47:812] [printer_kyocera_250]   ExitCode 0    Executed process "rundll32 printui.dll,PrintUIEntry /dl /n "Kyocera TASKalfa 250ci KX EMPFANG" /q"
[6] [Okt 30 11:51:47:813] [printer_kyocera_250]   Call ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /if /b "Kyocera TASKalfa 250ci KX EMPFANG" /r "10.0.0.55" /m "Kyocera TASKalfa 250ci KX" /z /f "p:\printer_kyocera_250\64bit\Win10\OEMSETUP.INF""
[6] [Okt 30 11:51:47:813] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 30 11:51:47:813] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 30 11:51:48:825] [printer_kyocera_250]   ExitCode 0    Executed process ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /if /b "Kyocera TASKalfa 250ci KX EMPFANG" /r "10.0.0.55" /m "Kyocera TASKalfa 250ci KX" /z /f "p:\printer_kyocera_250\64bit\Win10\OEMSETUP.INF""
[6] [Okt 30 11:51:48:825] [printer_kyocera_250]   Call ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Sr /n "Kyocera TASKalfa 250ci KX EMPFANG" /a "p:\printer_kyocera_250\prg\file.dat""
[6] [Okt 30 11:51:48:825] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 30 11:51:48:825] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 30 11:51:49:834] [printer_kyocera_250]   ExitCode 0    Executed process ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Sr /n "Kyocera TASKalfa 250ci KX EMPFANG" /a "p:\printer_kyocera_250\prg\file.dat""
[6] [Okt 30 11:51:49:834] [printer_kyocera_250]   Call ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "Kyocera TASKalfa 250ci KX EMPFANG" comment "Kyocera TASKalfa 250ci KX""
[6] [Okt 30 11:51:49:834] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 30 11:51:49:834] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 30 11:51:50:844] [printer_kyocera_250]   ExitCode 0    Executed process ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "Kyocera TASKalfa 250ci KX EMPFANG" comment "Kyocera TASKalfa 250ci KX""
[6] [Okt 30 11:51:50:844] [printer_kyocera_250]   Call ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "Kyocera TASKalfa 250ci KX EMPFANG" location "Kyocera TASKalfa 250ci KX""
[6] [Okt 30 11:51:50:844] [printer_kyocera_250]      Waiting until the called process is finished
[6] [Okt 30 11:51:50:844] [printer_kyocera_250]   Start process as invoker: SYSTEM
[6] [Okt 30 11:51:51:854] [printer_kyocera_250]   ExitCode 0    Executed process ""C:\Windows\system32\rundll32.exe" printui.dll,PrintUIEntry /q /Xs /n "Kyocera TASKalfa 250ci KX EMPFANG" location "Kyocera TASKalfa 250ci KX""
[6] [Okt 30 11:51:51:857] [printer_kyocera_250] If
[5] [Okt 30 11:51:51:857] [printer_kyocera_250]   CompareDotSeparatedNumbers($msversion$,"10.1") < "0.1"   <<< result true
[5] [Okt 30 11:51:51:857] [printer_kyocera_250]   CompareDotSeparatedNumbers($msversion$,"6.2") < "0.1" or CompareDotSeparatedNumbers($msversion$,"10.1") < "0.1"   <<< result true
[6] [Okt 30 11:51:51:857] [printer_kyocera_250] Then
[5] [Okt 30 11:51:51:859] [printer_kyocera_250]   Set  $Driverpath_Drucker_Reg$ = "p:\printer_kyocera_250\64bit\schwarz1-w7x64.reg"
[6] [Okt 30 11:51:51:859] [printer_kyocera_250]     The value of the variable "$Driverpath_Drucker_Reg$" is now: "p:\printer_kyocera_250\64bit\schwarz1-w7x64.reg"
[5] [Okt 30 11:51:51:859] [printer_kyocera_250]   
[5] [Okt 30 11:51:51:859] [printer_kyocera_250]   Execution of winbatch_import_options
[6] [Okt 30 11:51:51:859] [printer_kyocera_250]     Call "regedit.exe /s p:\printer_kyocera_250\64bit\schwarz1-w7x64.reg"
[6] [Okt 30 11:51:51:859] [printer_kyocera_250]        Waiting until the called process is finished
[6] [Okt 30 11:51:51:860] [printer_kyocera_250]     Start process as invoker: SYSTEM
[6] [Okt 30 11:51:52:873] [printer_kyocera_250]     ExitCode 0    Executed process "regedit.exe /s p:\printer_kyocera_250\64bit\schwarz1-w7x64.reg"
[5] [Okt 30 11:51:52:875] [printer_kyocera_250]   Set  $Driverpath_Drucker_Reg$ = "p:\printer_kyocera_250\64bit\schwarz2-w7x64.reg"
[6] [Okt 30 11:51:52:875] [printer_kyocera_250]     The value of the variable "$Driverpath_Drucker_Reg$" is now: "p:\printer_kyocera_250\64bit\schwarz2-w7x64.reg"
[5] [Okt 30 11:51:52:876] [printer_kyocera_250]   
[5] [Okt 30 11:51:52:876] [printer_kyocera_250]   Execution of winbatch_import_options
[6] [Okt 30 11:51:52:876] [printer_kyocera_250]     Call "regedit.exe /s p:\printer_kyocera_250\64bit\schwarz2-w7x64.reg"
[6] [Okt 30 11:51:52:876] [printer_kyocera_250]        Waiting until the called process is finished
[6] [Okt 30 11:51:52:876] [printer_kyocera_250]     Start process as invoker: SYSTEM
[6] [Okt 30 11:51:53:885] [printer_kyocera_250]     ExitCode 0    Executed process "regedit.exe /s p:\printer_kyocera_250\64bit\schwarz2-w7x64.reg"
[5] [Okt 30 11:51:53:885] [printer_kyocera_250]   Set  $Driverpath_Drucker_Reg$ = "p:\printer_kyocera_250\64bit\schwarz3-w7x64.reg"
[6] [Okt 30 11:51:53:885] [printer_kyocera_250]     The value of the variable "$Driverpath_Drucker_Reg$" is now: "p:\printer_kyocera_250\64bit\schwarz3-w7x64.reg"
[5] [Okt 30 11:51:53:885] [printer_kyocera_250]   
[5] [Okt 30 11:51:53:885] [printer_kyocera_250]   Execution of winbatch_import_options
[6] [Okt 30 11:51:53:886] [printer_kyocera_250]     Call "regedit.exe /s p:\printer_kyocera_250\64bit\schwarz3-w7x64.reg"
[6] [Okt 30 11:51:53:886] [printer_kyocera_250]        Waiting until the called process is finished
[6] [Okt 30 11:51:53:886] [printer_kyocera_250]     Start process as invoker: SYSTEM
[6] [Okt 30 11:51:54:895] [printer_kyocera_250]     ExitCode 0    Executed process "regedit.exe /s p:\printer_kyocera_250\64bit\schwarz3-w7x64.reg"
[6] [Okt 30 11:51:54:895] [printer_kyocera_250] EndIf
[5] [Okt 30 11:51:54:895] [printer_kyocera_250] 
[5] [Okt 30 11:51:54:895] [printer_kyocera_250] DosInAnIcon_set_rights
[6] [Okt 30 11:51:54:896] [printer_kyocera_250]   c:\opsi.org\tmp\_opsiscript_Ls06Zh25.cmd saved back
[6] [Okt 30 11:51:54:896] [printer_kyocera_250]   Executing "cmd.exe" /C c:\opsi.org\tmp\_opsiscript_Ls06Zh25.cmd
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]   ExitCode 5
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               output:
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               --------------
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               C:\Windows\system32>p:\printer_kyocera_250\prg\setacl -on "\\WM01-044\Kyocera TASKalfa 250ci KX EMPFANG" -ot prn -actn ace -ace "n:Jeder;p:full" 
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               INFO: Processing ACL of: <\\WM01-044\Kyocera TASKalfa 250ci KX EMPFANG>
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               ERROR: Reading the SD from <\\WM01-044\Kyocera TASKalfa 250ci KX EMPFANG> failed with: Der Druckername ist unzulõssig.
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               SetACL finished with error(s): 
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               SetACL error message: The call to GetNamedSecurityInfo () failed
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               Operating system error message: Der Druckername ist unzulõssig.
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]               
[6] [Okt 30 11:51:55:106] [printer_kyocera_250]   
[6] [Okt 30 11:51:55:110] [printer_kyocera_250]   Delete "c:\opsi.org\tmp\_opsiscript_*"
[6] [Okt 30 11:51:55:110] [printer_kyocera_250]     Search "c:\opsi.org\tmp\"
[6] [Okt 30 11:51:55:110] [printer_kyocera_250]     Search "c:\opsi.org\tmp\_opsiscript_*"
[5] [Okt 30 11:51:55:110] [printer_kyocera_250] 
[5] [Okt 30 11:51:55:110] [printer_kyocera_250] DOSBatch_del_folder
[6] [Okt 30 11:51:55:114] [printer_kyocera_250]   c:\opsi.org\tmp\_opsiscript_Vc63Kd77.cmd saved back
[6] [Okt 30 11:51:55:114] [printer_kyocera_250]   Executing "cmd.exe" /C c:\opsi.org\tmp\_opsiscript_Vc63Kd77.cmd
[6] [Okt 30 11:51:55:223] [printer_kyocera_250]   ExitCode 1
[6] [Okt 30 11:51:55:223] [printer_kyocera_250]   Delete "c:\opsi.org\tmp\_opsiscript_*"
[6] [Okt 30 11:51:55:223] [printer_kyocera_250]     Search "c:\opsi.org\tmp\"
[6] [Okt 30 11:51:55:223] [printer_kyocera_250]     Search "c:\opsi.org\tmp\_opsiscript_*"
[1] [Okt 30 11:51:55:223] [printer_kyocera_250] ___________________
[1] [Okt 30 11:51:55:223] [printer_kyocera_250] script finished
[1] [Okt 30 11:51:55:223] [printer_kyocera_250] 0 errors
[1] [Okt 30 11:51:55:223] [printer_kyocera_250] 1 warning
[1] [Okt 30 11:51:55:223] [printer_kyocera_250] 
[1] [Okt 30 11:51:55:223] [printer_kyocera_250] installed product: printer_kyocera_250 Version: 1.0-6
[1] [Okt 30 11:51:55:223] [printer_kyocera_250] 
[6] [Okt 30 11:51:55:224] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc setProductActionRequest
[6] [Okt 30 11:51:55:447] [printer_kyocera_250] JSON Bench for setProductActionRequest "params":["printer_kyocera_250","wm01-044.w-s.lan" Start: 11:51:55:223 Time: 00:00:00:224
[1] [Okt 30 11:51:55:521] [printer_kyocera_250] product printer_kyocera_250 set to update
[1] [Okt 30 11:51:55:521] [printer_kyocera_250] Update script name: 
[1] [Okt 30 11:51:55:521] [printer_kyocera_250] we have no update script
[6] [Okt 30 11:51:55:521] [printer_kyocera_250] JSON service request https://10.0.0.170:4447/rpc productOnClient_updateObject
[6] [Okt 30 11:51:55:603] [printer_kyocera_250] JSON Bench for productOnClient_updateObject "params":[{"clientId":"wm01-044.w-s.lan","actionRe Start: 11:51:55:521 Time: 00:00:00:082
Die Sektion [DosInAnIcon_set_rights] verrät aber auch leider schon, dass es scheinbar doch nicht so erfolgreich war :(

@edvbuo:
Deine Lösung habe ich auch mal getestet. Ich befürchte jedoch dass der Parameter /v hier Schwierigkeiten macht, bin mir aber nicht sicher, ob der auch Windows 10 einschließt.
%windir%\System32\rundll32.exe printui.dll,PrintUIEntry /if /b "$DruckerName$" /f "$DruckerPfad$" /r "IP_$DruckerIP$:" /m "$DruckerBeschreibung$" /v "Windows 2000 oder XP" /q
Vor lauter Verzweiflung spiele ich langsam mit dem Gedanken, hier ein Autoit Script zu basteln... Das werde ich auch mal tun und es hier posten, falls keinem mehr was anderes einfällt.

Ich werde auf jeden Fall gerne weitere Vorschläge annehmen und auch testen.

In diesem Sinne,
Schönes Wochenende
WSler
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von SisterOfMercy »

WSler hat geschrieben:Jetzt läuft das Script zumindest nicht mehr unendlich durch und steht am Ende auch auf Success...
Soweit sehr erfreulich :) Einziges Problem dabei: Auch nach mehrmaligen reboots des Clients ist weit und breit kein Drucker zu sehen :(

Dabei sieht die Log bis zum setzen der ACL ganz gut aus :
What is in those registry files?

And that acl part might not work because the printername is incorrect. First try that part by hand.
Perhaps without hostname?

Code: Alles auswählen

setacl -on "Kyocera TASKalfa 250ci KX EMPFANG" -ot prn -actn ace -ace "n:Jeder;p:full" 
I use subinacl for tasks like this.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
WSler
Beiträge: 11
Registriert: 28 Okt 2015, 13:42

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von WSler »

Hallo SisterofMercy,

In den Regfiles stehen Informationen wie "Standarddruck Schwarzweiß" usw... da steht auch ein Hex-Schlüssel mit drin, der aber unter Win7 Funktioniert hat (Wenn du willst poste ich dir den Inhalt gerne, aber die Hex-Schlüssel sind ewig lang).

Ich hatte aber auch schon probiert, die Sektion Registryimport einfach auszukommentieren und die Einstellungen dann über deine Methode vorzunehmen-> files.dat erstellen -> diese in %scriptpath%\prg\files.dat abglegen -> mit deiner Syntax das Script laufen lassen... leider ohne Erfolg :(
And that acl part might not work because the printername is incorrect. First try that part by hand.
Perhaps without hostname?
Mache ich gerne, aber ich nehme an, dass er hier Probleme hat, weil der Drucker nicht installiert ist und er den Namen folglich nicht finden kann. Der Drucker taucht ja nun auch nicht in der Computerverwaltung oder der Geräte-und Drucker Übersicht auf :(

PS: Ich bin ein wenig irritiert. Sollte ich meine Posts jetzt auf Englisch verfassen, oder ist Deutsch in dem Fall ok?
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von SisterOfMercy »

WSler hat geschrieben:PS: Ich bin ein wenig irritiert. Sollte ich meine Posts jetzt auf Englisch verfassen, oder ist Deutsch in dem Fall ok?
Deutsch is allright. I can read it, but not write it.

If I have a bit of spare time I'm going to try it myself with a different printer (not a virtual pdf printer).
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
hawaii
Beiträge: 77
Registriert: 03 Dez 2013, 13:32

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von hawaii »

Also ich installiere Drucker unter Windows7 bei uns mit Powershell. Hab allerdings keine Windows10 Erfahrung damit, aber vielleicht hilft es ja.
Dazu verwende ich folgendes Skript:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

[Actions]
requiredWinstVersion >= "4.11.2.6"

DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $NameOfInstance$
DefVar $DriverName$
DefVar $DriverPath$
DefVar $PortIp$
DefStringList $IsInstalled$
DefVar $test$

Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")


Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "printerKonicaSmall"
Set $MinimumSpace$    = "10 MB"
; the path were we find the product after the installation
Set $NameOfInstance$	= "PRINTERNAME"
Set $DriverName$	= "KONICA MINOLTA C554SeriesPCL"
Set $DriverPath$	= "%Scriptpath%\KonicaBIG\KOAYTJ__.INF"
Set $PortIp$		= "192.168.xxx.xxx"
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
	
	if FileExists("%ScriptPath%\delsub3264.ins")
		comment "Start uninstall sub section"
		Registry_patch /64Bit
		Set $IsInstalled$ = GetOutStreamFromSection('ExecWith_getPrinter "%System%\WindowsPowerShell\v1.0\powershell.exe" -command WINST /64Bit')
		comment $IsInstalled$
		Registry_unpatch /64Bit
		Sub "%ScriptPath%\delsub3264.ins"
	endif
	
	comment "installing"

	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		Message "Installing " + $ProductId$ + " 64 Bit..."
		comment "Patch registry to allow local powershell scripts...."
		Registry_patch /64Bit
		comment "Installing driver...."
		DosInAnIcon_Treiber
		comment "Installing printer port...."
		comment $PowerShellPath$
		ExecWith_setPort "%System%\WindowsPowerShell\v1.0\powershell.exe" -command WINST /64Bit
		comment "Installing printer...."
		ExecWith_setPrinter "%System%\WindowsPowerShell\v1.0\powershell.exe" -command WINST /64Bit
		comment "Patch registry to disallow local powershell scripts...."		
		Registry_unpatch /64Bit
	endif
	
endif

[Registry_patch]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
set "ExecutionPolicy" = "RemoteSigned"

[Registry_unpatch]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
set "ExecutionPolicy" = "Restricted"

[DosInAnIcon_Treiber]
rundll32 printui.dll,PrintUIEntry /ia /m "$DriverName$" /h "x64" /v "Typ 3 - Benutzermodus" /f $DriverPath$

[ExecWith_setPort]
Write-Output "Creating printer port `"$NameOfInstance$`""
$port =([WMICLASS]"\\.\ROOT\cimv2:Win32_TCPIPPrinterPort").createInstance()
$port.Name="$NameOfInstance$"
$port.SNMPEnabled=$false
$port.Protocol=1
$port.HostAddress="$PortIp$"
$port.Put()

[ExecWith_setPrinter]
Write-Output "Creating printer `"$NameOfInstance$`""
$printer =([WMICLASS]"\\.\ROOT\cimv2:Win32_Printer").createInstance()
$printer.Name="$NameOfInstance$"
$printer.DriverName="$DriverName$"
$printer.DeviceID="$NameOfInstance$"
$printer.PortName="$NameOfInstance$"
$printer.Put()

[ExecWith_getPrinter]
(Get-WmiObject Win32_Printer -Filter "Name='$NameOfInstance$'").PrinterStatus
Reine Treiberinstallation mache ich mit folgendem Skript:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

[Actions]
requiredWinstVersion >= "4.11.2.6"

DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefStringList $Drivers$
DefStringList $test$
DefStringList $Itty$
DefVar $DriverName$
DefVar $DriverPath$

Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")


Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "epsonPrinterPackage"
Set $MinimumSpace$    = "10 MB"
; the path were we find the product after the installation
Set $Drivers$ = loadTextFile("%Scriptpath%\drivers.txt")
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
	
	if FileExists("%ScriptPath%\delsub3264.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\uninstall.ins"
	endif
	
	comment "installing"

	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		Message "Installing " + $ProductId$ + " 64 Bit..."
		comment "Installing certs...."
		DosInAnIcon_Certs
		comment "Installing driver...."
		for %s% in $Drivers$ do Sub_create_vars
	endif
	
endif

[Sub_create_vars]
Set $Itty$ = splitString("%s%", ";")
Set $DriverName$ = takeString(0,$Itty$)
Set $DriverPath$ = takeString(1,$Itty$)
DosInAnIcon_Treiber

[DosInAnIcon_Treiber]
rundll32 printui.dll,PrintUIEntry /ia /m "$DriverName$" /h "x64" /v "Typ 3 - Benutzermodus" /f $DriverPath$

[DosInAnIcon_Certs]
%ScriptPath%\CertMgr.Exe -add "%ScriptPath%\certs\m2000.cer" -c -s -r localMachine TrustedPublisher
%ScriptPath%\CertMgr.Exe -add "%ScriptPath%\certs\m2000.cer" -c -s -r localMachine ROOT
%ScriptPath%\CertMgr.Exe -add "%ScriptPath%\certs\m2300.cer" -c -s -r localMachine TrustedPublisher
%ScriptPath%\CertMgr.Exe -add "%ScriptPath%\certs\m2300.cer" -c -s -r localMachine ROOT
%ScriptPath%\CertMgr.Exe -add "%ScriptPath%\certs\m2400.cer" -c -s -r localMachine TrustedPublisher
%ScriptPath%\CertMgr.Exe -add "%ScriptPath%\certs\m2400.cer" -c -s -r localMachine ROOT
WSler
Beiträge: 11
Registriert: 28 Okt 2015, 13:42

Re: Script zur Installation von Druckertreibern funktioniert nicht

Beitrag von WSler »

Hallo zusammen,

@SisterOfMercy:
If I have a bit of spare time I'm going to try it myself with a different printer (not a virtual pdf Printer).
Mach dir bitte keinen Stress... Wenn das hier am Ende nicht klappt, muss ich meinem Chef eben beibringen, dass wir für die Druckerinstallation unter Win10 erstmal eine Übergangslösung brauchen.

@Hawaii:
Ich habe mir dein Script mal angeschaut und es unterscheidet sich ja im großen und ganzen nicht von den bereits geposteten. Aber ein kleiner Unterschied ist mir doch aufgefallen:

Code: Alles auswählen

[DosInAnIcon_Treiber]
rundll32 printui.dll,PrintUIEntry /ia /m "$DriverName$" /h "x64" /v "Typ 3 - Benutzermodus" /f $DriverPath$
Den hatte ich auf Englisch angegeben... also "Type 3 - Usermod"
Habe ich Testweise mal getauscht und laufen lassen... das war es leider auch nicht :(

Wenn ich alle diese Skripte auf dem Rechner lokal ausführe, funktioniert jede Variante... Kann es möglicherweise an den Berechtigungen liegen?

Denn wenn ich es offline mit einem Admin-Account mache, dann läuft der sorglos durch. Ich meine mich schwarz erinnern zu können, dass Opsi als System-User seine Installationen macht, kann hier der Hase begraben liegen?
Denn sobald der Treiber einmal druf ist, lassen sich alle Drucker mit dem selben Treiber auch installieren.

Ich habe Probeweise auch mal eine Batch mit dem Printui-Befehl gemacht und dort per Hand alle Parameter eingesetzt. Dabei ist mir folgendes aufgefallen: Sobald ich den Befehl abschieße, wird nach einer Elevation gefragt (Wobei mir das bei einer *.INF-Datei spanisch vorkommt :shock: ).

Vielleicht bringt dieser Gedankenanstoß ja neue Ideen :)
MfG
WSler
Antworten