Microsoft provides a prnmngr.vbs script with Windows XP and Small Business
Server (SBS) 2003 systems. This script can be found in %windir%\system32,
which will normally be c:\windows\system32. The script can be used to add,
delete, and list printers or printer connections. It can also be used to
set or display the default printer. If you run the script using cscript without
any parameters it will display the usage information shown below. If you are
unfamiliar with cscript, it provides a mechanism for running VBS scripts. The "/nologo" option
for cscript supresses the display of the Microsoft logo information normally
displayed when a script is run with cscript. You can run the script from
a command line. You need to change to the %windir%\system32 directory or
include the full path to the script when you run it, e.g.
cscript /nologo c:\windows\system32\prnmngr.vbs -l
.
C:\WINDOWS\system32>cscript /nologo prnmngr.vbs
Usage: prnmngr [-adxgtl?][c] [-s server][-p printer][-m driver model]
[-r port][-u user name][-w password]
Arguments:
-a - add local printer
-ac - add printer connection
-d - delete printer
-g - get the default printer
-l - list printers
-m - driver model
-p - printer name
-r - port name
-s - server name
-t - set the default printer
-u - user name
-w - password
-x - delete all printers
-? - display command usage
Examples:
prnmngr -a -p "printer" -m "driver" -r "lpt1:"
prnmngr -d -p "printer" -s server
prnmngr -ac -p "\\server\printer"
prnmngr -d -p "\\server\printer"
prnmngr -x -s server
prnmngr -l -s server
prnmngr -g
prnmngr -t -p "\\server\printer"
If you want to view the default printer for a system you can use the
-g
parameter.
C:\WINDOWS\system32>cscript /nologo prnmngr.vbs -g
The default printer is Microsoft Office Document Image Writer
If you want to view all of the printers for a system and save the output to a file, such as printers.txt, you could use the following command.
C:\Documents and Settings\Administrator>cscript /nologo
c:\windows\system32\prnmngr.vbs -l >printers.txt
The information that will be displayed for each printer when you use the
-l
option will be similar to that shown below.
Server name
Printer name HP Business Inkjet 3000 PCL 6
Share name Pam HP3000
Driver name HP Business Inkjet 3000 PCL 6
Port name USB002
Comment
Location
Print processor WinPrint
Data type RAW
Parameters
Attributes 8776
Priority 1
Default priority 0
Status Unknown
Average pages per minute 0
References: