• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Printer Deployment does not install driver but port

    Scheduled Pinned Locked Moved Solved
    Windows Problems
    6
    22
    8.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JJ FullmerJ
      JJ Fullmer Testers @x23piracy
      last edited by

      @x23piracy It uses the printUI.DLL

      The code looks like PrintUI($"/if /q /b \"{printer.Name}\" /f \"{printer.File}\" /r \"{printer.Port}\" /m \"{printer.Model}\"")
      The command line to try it yourself manually looks like RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /q /b "Printer Name" /f "path\ot\inf" /r "Printer Port Name" /m "Printer Model referenced in INF" You may want to take out the /q so you get error messages.

      Personally I use the following script template for each of my network printers on my base image and then remove them and use the C:\Windows\INF\oem#.inf file that gets created for each printer. You just have to watch and document which oem#.inf the pnputil adds the driver too.

      ::-----------------------------------------------------------------------------
      :: Script Name: InstallPrinters
      :: Original Author: jfullmer
      :: Created Date: 2016-02-18 16:39:19
      :: Last Updated Date: 2016-03-16 10:01:27
      :: Update Author: jfullmer
      :: Version: 2.0
      ::-----------------------------------------------------------------------------
      
      @ECHO off
      
      call :main
      exit
      
      :main
      	REM Function to call other functions and run the installation process
      
      	call :setVars
      	call :funcHead "Welcome to the Printer installer!"
      	REM inputs: 1 - Printer Port Name, 2 - printer ip or hostname 3- driverPath 4 - printer name 5 - printer model 6 - config file 7 - raw or lpr
      
      	call :installPrinter %portName% %hostname% "%inf%" "%printerName%" "%printerModel%" "%config%" %portType%
      
      	EXIT /B
      
      :setVars
      	REM function for setting script variables, typically for directories
      
      	:: Set input names in the set commands, should be easier this way
      	:: Avoid using quotes in variable definitions, enclose the calls to variables in quotes instead
      	call :funcHead "Setting script variables"
      	set share=\\path\to\drivers\share
      	set portName=
      	set hostname=
      	set inf=%share%\
      	set printerName=
      	set printerModel=
      	set config=%share%\
      	set portType=raw
      	
      	echo. mounting share...
      	net use "%share%"
      	
      	echo. done!
      
      	EXIT /B
      
      :installPrinter
      	REM Function to add a new Printer
      	REM inputs: 1 - Printer Port Name, 2 - printer ip or hostname 3- driverPath 4 - printer name 5 - printer model 6 - config file 7 - raw or lpr
      
      	call :funcHead "Installing Printer %~4"
      
      	call :printerPort %~1 %~2 %~7
      	call :printerDriver "%~3"
      	call :addPrinter "%~4" "%~5" %~1
      	call :configPrinter "%~6" "%~4"
      
      	echo. done installing printer %~4!
      
      	EXIT /B
      
      :printerPort
      	REM function for adding a printer port
      	REM var inputs 1 - port name 2 -hostname or ip address 3 -port type (raw or lpr)
      
      	call :dots
      	echo. Creating the printer port...
      	
      	IF %~3==lpr (
      		Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r %~1 -h %~2 -o lpr -q lp -n 515
      	) ELSE ( REM raw
      		Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r %~1 -h %~2 -o raw -n 9100 
      	) 
      	
      	echo. done!
      	call :dots
      
      	EXIT /B
      
      :printerDriver
      	REM function to add the driver input 1=full driver path
      
      	call :dots
      	
      	echo. Adding printer driver...
      	PNPUTIL -i -a "%~1"
      	echo. done!
      	
      	call :dots
      
      	EXIT /B
      
      :addPrinter
      	REM add the printer to the created port
      	REM 1 - printer name 2 - printer model associated with driver 3 - port name
      	
      	call :dots
      	
      	echo. adding printer to network port...
      	Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs -a -p "%~1" -m "%~2" -r %~3
      	echo. done!
      	
      	call :dots
      
      	EXIT /B
      
      :configPrinter
      	REM add any special printer configurations
      	REM 1 - config file path 2 - printer name
      
      	call :dots
      	
      	echo. Configuring Printer...
      	REM To create a config file for a printer, use the following syntax
      	REM RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /nPrinterName /a ConfigFilePath.dat m f g p
      	RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n"%~2" /a %~1 m f g p
      	echo. done!
      	
      	call :dots
      
      	EXIT /B
      
      :dots
      	REM just echoing dots in a Function instead of copy pasting them so that it's consistent
      	echo ......................................................................
      	EXIT /B
      
      :funcHead
      	REM A simple function for displaying a consistent header at the start of functions
      	call :dots
      	echo. %~1
      	call :dots
      	EXIT /B
      

      Also, it sounds like this is an HP printer. I’ve had some good luck using the HP universal print driver.
      Within the hp universal print driver files, the inf you need is something along the lines of hpcu180u.inf With a model name of “HP Universal Printing PCL 6”(The numbers slightly change with each version of the UPD, but that’s the general structure of the file that works) But you will need all the other files from the driver in the original directory structure. In other words, you can’t just copy the inf file to the share because it will look for more files that are referenced. This is probably also the case for the model specific print driver, so if you are only putting the inf in the share, that could also be the problem.

      I hope that helps

      Have you tried the FogApi powershell module? It's pretty cool IMHO
      https://github.com/darksidemilk/FogApi
      https://fogapi.readthedocs.io/en/latest/
      https://www.powershellgallery.com/packages/FogApi
      https://forums.fogproject.org/topic/12026/powershell-api-module

      1 Reply Last reply Reply Quote 0
      • x23piracyX
        x23piracy
        last edited by x23piracy

        Solved
        https://forums.fogproject.org/topic/7441/fog-7645-and-client-10-6-printers-and-snapins-not-working/7

        ║▌║█║▌│║▌║▌█

        1 Reply Last reply Reply Quote 0
        • 1
        • 2
        • 2 / 2
        • First post
          Last post

        193

        Online

        12.0k

        Users

        17.3k

        Topics

        155.2k

        Posts
        Copyright © 2012-2024 FOG Project