PCright, Inc. | Recently... | Elsewhere | Search | Login |

This is the area where you can put a text about yourself or your blog. You can change the colours and the layout as you like, but please keep the footer link the way the way it is so that other can find the way back to me. Thanks for using this theme, I really appreciate it. This theme is released under those Creative Commons terms of use. And now ENJOY and get blogging!

continue reading this article






fancy

Setup Windows Printers from a batch file.

23 10 2009

0

I’ve got a little free time for a change, so why not write something vaguely useful.

I have been scripting printer installs successfully on XP, the release of Win 7 shouldn’t change that procedure (much).  7 still has most of the familiar admin scripts as XP. So we should still be able to setup printers through those same scripts instead of having to babysit each printer.  The basic idea is to obtain manufacturer’s drivers and get them unzipped onto the destination computer.  Then run scripts that are distributed with Windows (they live in C:\Windows\system32\).  The scripts can be called, in turn, from a simple batch file.

Some notes:

  • My installs all use Standard TCP/IP Printer ports.
  • Watch out for directory path slashes.  The scripts expect path names to be escaped.
  • Exact driver names (and they’re case sensitive) must be used.
  • Some drivers must be unzipped to a specific folder, others don’t care.
  • You’ll have to dig around in the printer driver install folder to find the correct hardware inf, and specify it’s full path and name.
  • cscript requires the full path to the admin script you are calling.
  • Unzip32.EXE came from http://www.info-zip.org/

Here’s a single printer batch example (it can be expanded for any number and types of printers):

#REM 1. Extract HP Universal PCL Driver
#REM This driver is touchy about its destination.  It must go in the specified directory
unzip32 -d “\HP PCL5 Universal Print Driver” “ljp2035pcl5 – HPUPD47PCL532.exe”

#REM 2. Install driver.

cscript.exe c:\WINDOWS\system32\prndrvr.vbs -a -m “HP Universal Printing PCL 5″ -e “Windows NT X86″ -h “c:\\HP PCL5 Universal Print Driver\\” -i “C:\\HP PCL5 Universal Print Driver\\hpcu083b.inf”

#REM 3. Setup Copy Room Printer Port
cscript.exe c:\windows\system32\prnport.vbs -a -r IP_192.168.70.11 -h 192.168.70.11 -o raw -n 9100

#REM 4. Actual printer install

cscript.exe c:\windows\system32\prnmngr.vbs -a -p “LaserJet Copy Room” -r “IP_192.168.70.11″ -m “HP Universal Printing PCL 5″

categories Published under: Technology


Leave a message or two

Name (required)

Email (required)

Website



XHTML: The following tags are allowed:

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please leave a comment