Novell Home

Push Printer Settings along with Printer Driver

Novell Cool Solutions: Trench
By Dennis Hestbech

Digg This - Slashdot This

Posted: 4 Mar 2004
 

Novell promises that the next full version of NDPS will - as a new functionality - facilitate pushing printer driver settings to the clients along with installing the printer driver.

If you can't wait for this, and have a little energy, it can be done.

Some admins may know that it is possible to install an NDPS printer using Window's RunDll command.

It is also possible to make RunDLL write the actual printer settings to a binary file, tuck it up your sleeve, and later perform the wizardry of a modern-day double-click hero. The only catch is that the printer has to be installed already, before you can push the settings down to it.

This is how:

Say your eDirectory tree name is TREE_NAME, and your NDPS printer object is .OU=PrinterX.OU=NDPS.O=ACME_CORP

You can now install the printer (provided you have the proper drivers for it already in NDPS), by running the command:
RUNDLL32 PRINTUI.DLL,PrintUIEntry /in /n \\TREE_NAME\PrinterX.NDPS.ACME_CORP
This will install the printer, however only with default driver settings.

Now, tune your printer driver to your heart's content, including typing the location of the printer, add optional hardware, duplex units, paper trays, etc.

To save the printer settings in a file, run the command:

RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n \\TREE_NAME\PrinterX.NDPS.ACME_CORP /a z:\NDPS\printerX.bin

(I find sys:\public\NDPS a good place for the file, but suit yourself.)

And now for the fun part:

Install the printer by means of policy, the above mentioned RunDll command, or whatever.

Then run the command:

RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n \\TREE_NAME\PrinterX.NDPS.ACME_CORP /a z:\NDPS\printerX.bin g d

This pushes the settings that you earlier saved down to the printer.

Put these commands together in a .cmd file or push them with ZENworks, whatever rocks your boat.

  • Update: It seems the optimum parameters to use when pushing the settings back are "d u g 2" the "u" gives user options like portrait/landscape choise, and the "2" takes the comment and location fields also.
  • Example batch file:

    RUNDLL32 PRINTUI.DLL,PrintUIEntry /in /n \\TREE_NAME\PrinterX.NDPS.ACME_CORP 
    RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n \\TREE_NAME\PrinterX.NDPS.ACME_CORP
    /a z:\NDPS\printerX.bin g d

    Notes:

    • In a command window or from the start menu, invoke the command 'RUNDLL32 PRINTUI.DLL,PrintUIEntry /?' to see what else PRINTUI.DLL has to offer. Maybe there is more fun to be had ?
    • The option /q (quiet install, no user input) and/or /Gw (do not show GUI warning, absolutely no user input) doesn't work on my Danish XP SP1.
    • If you know how to get rid XP's rather annoying warning (that driver files may contain viruses and such), please let me know.

    Other Suggestions

    Feedback: I've used autoit in the past to "bypass" the Windows XP messages that pop up. This was written for autoit 2.x. printersetup.bat is my rundll entries for installing the NDPS printers.

    ;autoit script start
    run, Z:\\printer_settings\\printersetup.bat 
    
    loop:
    Winwait, Connect to Printer,,5
    IfWinExist, Connect to Printer,, Goto, sendkeysdriver
    IfWinExist, Hardware Installation,, Goto, sendkeysunsign
    Goto, Checkloop
    
    sendkeysdriver:
    WinActivate, Connect to Printer
    send, !y
    Goto, Checkloop
    
    sendkeysunsign:
    WinActivate, Hardware Installation
    send, !c
    Goto, Checkloop
    
    
    checkloop:
    IfWinExist, PrinterSetup,, Goto, loop
    goto, end
    
    end:
    Exit


    Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

    © 2014 Novell