none
Add printer script help

    Question

  • Hey all, 

    I have been tasked with creating a script for installing printers on user machines using a .bat file. We don't use a print server, so below I have a script I created from hours of trial and research (I'm new to scripting). 

    mkdir "C:\New Folder\Printer Drivers"   - Creating folder on the C: that will host the printer driver

    robocopy "\\server\Printer Drivers\MFC-L6700DW\brprm15a.inf_amd64_3790bb599c0b2bd9" "C:\utilities\Printer Drivers" /E /IS   - Copying all contents of printer driver folder from server to be stored in printer driver folder just created on the C: above

    Cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\Prnport.vbs" -a -r 192.168.1.28 -h 192.168.1.28 -o raw -n 9100    -  Creating/overwriting port for the static IP assigned to the printer

    Cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -m "Brother MFC-L6700DW series" -h "C:\utilities\Printer Drivers\" -i "C:\utilities\Printer Drivers\brprm15a.inf"   - What I thought would be the right line to install the driver

    Cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs" -a -p "Brother MFC-L6700DW (2nd Floor Supply Closet)" -m "Brother MFC-L6700DW series" -r "192.168.1.28"   - Adding and naming the printer

    * actual name of server and folders removed

    I keep getting the generic error reply:   

    Unable to add printer Brother MFC-L6700DW (2nd Floor Supply Closet) Error 0x80041001 Generic failure
    Operation PutInstance
    Provider Win32 Provider
    Description The printer driver is unknown.
    Win32 error code 1797

    Any help would be greatly appreciated. I'm spinning my wheels on this. 


    Tuesday, December 4, 2018 6:40 PM

All replies

  • Use PowerShell.  It has commands that make this much easier.

    help print


    \_(ツ)_/

    Tuesday, December 4, 2018 6:54 PM

  • Description The printer driver is unknown.
    Win32 error code 1797


    Printer drivers must be installed before trying to install a printer.

    In a domain  you should be using a print server which automates all printer installations.  Clients just attach to the printer and the rest is automatic.

    What you are doing is designed for stand alone systems and not for networked systems.


    \_(ツ)_/

    Tuesday, December 4, 2018 6:56 PM
  • I would think it's much simpler to use a GPO to deploy printers.

    -- Bill Stewart [Bill_Stewart]

    Tuesday, December 4, 2018 7:03 PM
    Moderator
  • GP will define the connection and port but not the driver.  Many drivers have complex installations.  If a printer supports the universal print driver model then GP can install it.

    Only print spooler based printers that support print driver pushing will run without anything more than assigning the print queue in GP.

    HP Print spoolers can allow installation using push drivers and universal drivers.


    \_(ツ)_/


    • Edited by jrv Tuesday, December 4, 2018 7:13 PM
    Tuesday, December 4, 2018 7:12 PM