Add, delete and list printers and printer connections, can also display or set the default printer.

      cscript PRNMNGR.vbs [-options] [-s server] [-p printer_name] [-m driver model]
                  [-r port] [-u user_name] [-w password]


   -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
   -xc  Delete all printer connections
   -xo  Delete all local printers
   -?   Display help

PrnMngr.vbs is not on the Windows PATH but will be found at:

All recent versions of Windows have automatic default printer management enabled by default. This can be enabled or disabled via policy:
'User Configuration ➞ Policies ➞ Administrative Templates ➞ Control Panel ➞ Printers': 'Turn off Windows default printer management'.


Set _scripts=cscript %Windir%\System32\Printing_Admin_Scripts\en-US

:: Add printer 'print64'
%_scripts%\prnmngr.vbs -a -p "print64" -m "Brother 2140" -r "lpt1:"

:: Delete the printer 'print64' from print server 'prnserv1'
%_scripts%\prnmngr.vbs -d -p "print64" -s prnserv1

:: Connect to printer
%_scripts%\prnmngr.vbs -ac -p "\\prnserv1\print64"

:: Delete a printer connection
%_scripts%\prnmngr.vbs -d -p "\\prnserv1\print64"

:: List all printers on a printserver
%_scripts%\prnmngr.vbs -l -s prnserv1

:: Delete all printers on a printserver
%_scripts%\prnmngr.vbs -x -s prnserv1

:: List a specific printer
%_scripts%\prnmngr.vbs -l |find "Printer name"

:: Get the DEFAULT printer
%_scripts%\prnmngr.vbs -g

:: Set the DEFAULT printer
%_scripts%\prnmngr.vbs -t -p "\\server\printer"

“We photographers deal in things which are continually vanishing, and when they have vanished there is no contrivance on earth can make them come back again. We cannot develop and print a memory” ~ Henri Cartier-Bresson

Related commands

NET VIEW \\Printserver - to view a list of available printers.
NET PRINT - View and Delete print jobs.
PRNCNFG - Add, delete, or list printers / connections, set the default printer.
PRNDRVR - Add, delete or list printer drivers.
PRNJOBS - Pause, resume, cancel, or list print jobs.
PRNPORT - Manage TCP/IP printer ports, change port configuration.
PRNQCTL - Manage printer queues, print a test page.
PRINT - Print a text file.
RUNDLL32 - Install/Remove Printers (plus advanced options).
WMIC PRINTER - Set printing options through WMI.
Q246868 - TCP/IP Printing options in the Windows Standard Port Monitor.
Add printer - .AddPrinterConnection
Add Network printer - .AddWindowsPrinterConnection
List printers - .EnumPrinterConnections
Set default printer - .SetDefaultPrinter
Equivalent bash command (Linux): lpc - Line printer control program.

Copyright © 1999-2024
Some rights reserved