JSI Tip 6065. Adprintx freeware manages printers from the command line.

Jerold Schulman

December 11, 2002

5 Min Read
ITPro Today logo in a gray background | ITPro Today



Download Adprintx freeware to manage printers from the command line.

The readme.txt file contains:

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::    DOCUMENT:     AdPrintX Readme    AUTHOR:       James Hart ([email protected])    CREATED:      3 May 2002    VERSION:      1.0.0.001::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::IMPORTANT:    - To install network printers for Windows 9x systems it is       necessary for the appropriate printer drivers to be available       on the system.  See below for further information.    - AdPrintX has been tested on Windows 95® and Windows 98®       (preliminary testing only), Windows NT®, Windows 2000® and       Windows XP®.  Has NOT been tested on Windows ME®.LEGAL:    - AdPrintX is available as freeware and, as such, provides no       guarantee.  Any usage of this utility is completely at the       users own risk.AUDIENCE:    - Microsoft network administratorsOVERVIEW:    - AdPrintX is a utility to manage Windows® network printers from       the command line.  It was originally designed to complement      client printer management for Windows Terminal Server® and       Citrix® environments, as well as other network printer control.    CON2PRT COMPATIBILITY -    - AdPrintX is very similar to Microsoft's Zero Administration Kit      printer management utility Con2Prt, but has additional       functionality, including compatibility with Windows 9x systems.    - AdPrintX is based on Con2Prt's parameters and should be able to      directly replace Con2Prt with AdPrintX for Windows NT or later      systems to control network printers - BUT PLEASE DO YOUR       TESTING FIRST.    - AdPrintX provides for the removal of a single network printer      (see "/r" option in usage), as wells all network printers (see      "/f" option in usage).    WINDOWS 9x -    - in Win9x, both local and network printers are controlled by      the local print processor and must have the appropriate drivers      available on the system.  You can achieve this in a number of       ways -          - install the printer drivers via the Windows print manager          - copy the appropriate drivers to the system and then let            AdPrintX install the driver            TIP: if you print a test page for a locally installed                  printer it will generally list the drivers and                  everything else you need to know to install the                  printer          - whatever other way you can dream up...    - Win9x requires additional parameters to be filled to add a      printer.  You will need to specify driver name (/n) and driver       file (/s) parameters, plus a name for the printer (/p).        TIP: Use " ()" as the printers name           so as not to clash with the same printer name from another           server.USAGE:    [ /? | /h | /l | /v | /f | [/r "\server\printer" ] |        [/c "\serverprinter" | /cd "\serverprinter"         /p "Printer Name" | /n "Driver Model"         /s "driverpathfilename" [ /t "datatype" = "EMF" ] ] ]    WHERE:    /? or /h  - help    /l        - list all installed and connected printers    /v        - verbose operation (displays messages)    /c or /cd - UNC of network printer (e.g. "\server\printer")    /p        - printer name (e.g. "MyPrinter (MyServer)" *    /n        - driver name (e.g. "Canon LBP-8 III") *    /s        - driver path (e.g. "c:windowssystemcanonlbp.drv") *    /t        - datatype (e.g. "RAW" - default is "EMF") *    /d or /cd - make printer the default (e.g. "\serverprinter")    /r        - remove network printer connection (e.g. "\serverprinter")    /f        - remove all network printer connection    - * used by Win9x only    - order of parameters is not important    - Win9x specific parameters are ignored by WinNT or higher systems    - sequence of operation is -        - list installed printers        - remove single printer        - remove all printers        - add printer        - set default printerREQUIRED FILES:    - AdPrintX.exeEXAMPLES:    IMPORTANT: multiple lines used in examples is for readability only    - remove a network printer and add a printer and sets it as the       default (messages are displayed) -         AdPrintX.exe /v /r "\MySvrhplaser" /cd "\MySvrcanon lbp"                       /p "Canon LBP-8 (MySvr)" /n "Canon LBP-8 III"                       /s "c:windowssystemcanonlbp.drv"      NOTE: this will work for both Win9x and WinNT (or higher) systems    - add a printer (WinNT or higher only) -         AdPrintX.exe /c "\MySvrcanon lbp"     - remove a printer (all Windows versions) -         AdPrintX.exe /r "\MySvrcanon lbp"     - list all installed printers -         AdPrintX.exe /l    - remove all network printers (messages are displayed) -         AdPrintX.exe /f /v    NOTES -    - always place double quotes around parameter values to ensure      the argument is read correctly including its spaces (e.g.       "\MySvrcanon lbp").    - sometimes the command prompt window in Win9x will not hold the       required command line.  As a work around move these commands       to a batch file.KIX SCRIPT EXAMPLE:    - this example can be used in a Kix script to install a printer      on either Win9x or (>=) WinNT systems.  The beauty of this set      up is if you wish to change the server from where your users      print you need only change the $PrintSvr variable to the name      of your new print server (this is assuming your printer and its      share name is the same) -        $DblQ = Chr(34)        ; print server        $PrintSvr   = "\MySvr"        ; local kix path        $KixPath = "c:kix"        ; assign command line        $AdPrintX_Cmd =            "/cd " + $DblQ + $PrintSvr + "hp laser" + $DblQ + " " +           "/p "  + $DblQ + "HP Laser (" + LCASE(SUBSTR( $PrintSvr, 3, LEN($PrintSvr))) + ")" + $DblQ + " " +           "/n "  + $DblQ + "HP Laserjet 4Si" + $DblQ + " " +           "/s "  + $DblQ + "c:windowssystemhppcl5ms.drv" + $DblQ + " " +           "/t "  + $DblQ + "RAW" + $DblQ + " "        IF GetFileAttr( $KixPath + "AdPrintX.exe" ) > 0           ; call AdPrintX           SHELL $KixPath + "AdPrintX.exe /v " + $AdPrintX_Cmd           IF @ERROR  0              ? "Error occurred...AdPrinX returned error..."           END IF        ELSE           ? "Error occurred...could not find path..."        ENDIFVERSIONS:    Version 1.00.001  (previous version n/a)    ADDITIONS -    - n/a    BUG LIST -    - none known    FUTURE VERSION -    - include indication of the default printer when listing printers    - include flag to specify printer memory (??)



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like