Managing Printers from the Command Prompt in Windows 10 / 8.1

Today we’ll discuss alternatives of managing printers and their drivers from the command immediate in Windows 10/ 8.1 and Windows Server 2012 R2/ 2016. We will take into account methods to set up a brand new native or community printer, print driver, create a TCP/IP print port, print a take a look at web page, delete a driver or printer utilizing easy Windows instructions. It may be helpful in varied situations unattended printer set up in SCCM duties, logon scripts of the group insurance policies and on the servers operating in the Server Core mode.

Ready-to-Use VBS Scripts to Manage Printers in Windows

To handle printers, Microsoft has developed a number of VBS scripts that assist you to handle printers and print queues, set up and uninstall printer drivers, and so on.

These scripts are current in all Windows variations (beginning from Vista and Windows Server 2008) and are positioned in the listing C:WindowsSystem32Printing_Admin_Scriptsen-US.


  1. Instead of en-US listing, there may be one other listing comparable to the system language;
  2. In Windows XP and 2003 these VBS situations are saved in the C:WINDOWSsystem32 listing.

The following VBS scripts are positioned in this folder:

  • Prncnfg.vbs – a script to show details about the printer settings;
  • Prndrvr.vbs – printer driver administration (set up / uninstall printer drivers);
  • Prnjobs.vbs – managing print jobs;
  • Prnmngr.vbs – managing printers (together with creating and eradicating printer in the system);
  • Prnport.vbs – managing connection to the distant printer by way of TCP/IP ports;
  • Prnqctl.vbs – print queue administration;
  • Pubprn.vbs – managing printer publishing in Active Directory.

Note. One of the well-known methods of managing printers in totally different variations of Windows is the host course of rundll32.exe, which receives the title of the library printui.dll and the entry level to it (PrintUIEntry). The command rundll32 printui.dll,PrintUIEntry is sufficient to carry out fundamental operations with printers and is totally supported by Microsoft, however the use of specified vbs scripts is preferable from the administrator viewpoint.

Let’s take into account typical situations of utilizing these VBS scripts.

How to Install a Printer Driver from the Command Line

Permissions to put in and configure native printers can be found for members of the following native teams: Administrators, Print Operators or Server teams.

Install the HP printer driver utilizing the command:
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprndrvr.vbs" -a -m "HP Universal Printing PCL 6" -i "C:drvHP Universal Print Driverhpcu160u.inf"

Let’s take into account the parameters of the command:

-a – add printer driver;

-m “HP Universal Printing PCL 6”– the title of the printer driver;

-i “path” – the full path to the driver’s INF file.

After the driver is put in, it seems in the print server properties (Control PanelHardware and SoundDevices and Printers ->Print Server Properties).

Note. If you’re utilizing an incompatible printer driver, you may set up it .

How to Add a New Printer from the Command Prompt

Using the following command, you may set up a brand new printer named HP5525 utilizing the beforehand put in HP Universal Printing PCL 6 print driver:
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" -a -p "HP5520" -m "HP Universal Printing PCL 6" -r "lpt1:"

-a – a brand new native printer is put in;

-p “HP5520” – a show title of the printer;

-m “HP Universal Printing PCL 6” – a print driver that’s used;

-r “lpt1:” – a reputation of the native print port used. In this case, printing needs to be carried out by way of the LPT port. Here you may specify the parallel port (LPT1:, LPT2:), serial (COM1:, COM2: – earlier than set up, be sure that this by one other gadget) or USB port (USB001, and so on.).

Managing Default Printer Using CMD

From the command line, you may select which printer to make use of for default printing. With the following command you may checklist all put in printers:

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" –l

You can get the title of the present default printer:

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" –g

The default printer is HP Universal Printing PCL 6 (redirected 1)

To set a distinct default printer, run the command:

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" -t –р "HP5525"

How to Create a TCP/IP Port for a Network Printer

If you wish to join a community printer, it’s essential to first create a TCP/IP printer port for it (suppose the printer IP handle is
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USPrnport.vbs" -a -r IP_192.168.1.22 -h -o uncooked -n 9100
-r IP_192.168.1.22 – a reputation of the community port;

-h – IP handle of the gadget;

-o uncooked – a port sort (uncooked or lpr);

-n 9100 – the variety of the TCP port of the gadget (normally 9100).

And then you may set up a brand new community printer on the system:
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" -a -p "HP5525" -m "HP Universal Printing PCL 6" -r " IP_192.168.1.22"
After the script is over, a brand new printer HP5525 seems in the system.

How to Print a Test Page from the CMD

To print a take a look at web page on the printer you may have created, do the following:
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnqctl.vbs” -e -p "HP5525"

Manage Print Queues from the Command Prompt

Using the prnjobs.vbs script, you may view print jobs in queues. To show all print jobs for all native printers, run the command:
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnjobs.vbs” –l

To show jobs on a particular printer, you’ll want to specify its title:

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnjobs.vbs” –l –p HP5525

To clear the print queue on one printer, run the following command:

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnjobs.vbs” –x –p HP5525

Or you may rapidly clear all queues for all printers (that is rather more handy than manually cleansing the print queues):

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnjobs.vbs” –x

Share a Network Printer Using the Command Line

All new printers that you simply put in in Windows from the command immediate are native. You can share them with different customers over the community from the Windows GUI (see the ). You may share the printer from the command line. For instance, you wish to present community entry to your HP5525 printer by publishing it underneath the title HP5525_Shared. Use the command:

script "C:WindowsSystem32Printing_Admin_Scriptsen-USprncnfg.vbs” -t  -p  HP5525 -h "HP5525_Shared" +shared

To disable printer sharing, run:

script "C:WindowsSystem32Printing_Admin_Scriptsen-USprncnfg.vbs” -t -p "HP5525" -shared

Similarly, you may publish a printer in Active Directory:

script "C:WindowsSystem32Printing_Admin_Scriptsen-USprncnfg.vbs” -t  -p HP5525 +revealed

To take away printer from the, use the “-published” argument.

How to Add a Network Printer by way of the Command Line

To join a shared community printer related to a different pc, use the

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" -ac -p “rome-prnt01hp2100”

Quite frequent errors when connecting community printers – , and . Ways to unravel errors can be found at the hyperlinks above.

How to Remove a Printer and Its Driver from the Command Prompt

An entire checklist of printers in the system may be displayed as:

cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" -l

A printer may be eliminated with the following command:
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs" -d -p "HP5525"
The print driver is deleted as follows:
cscript "C:WindowsSystem32Printing_Admin_Scriptsen-USprndrvr.vbs" -d -m "HP Universal Printing PCL 6" -e "Windows x64" -v three

In this text we regarded the fundamental operations with good previous Microsoft VBS scripts that permit to handle printers and their drivers from the command line in varied Windows variations. . An entire checklist of the capabilities and arguments of those scripts can be found in Microsoft documentation or in the in-built assist of the situations (simply run the script file with out parameters in the command line).

In the we’ll introduce a brand new alternatives of printer administration in Windows 10 / 8.1 and Windows Server 2016 / 2012 R2 offered by PowerShell.

Check Also

How to Enable and Configure MPIO on Windows Server 2016/2012R2?

In this text we’ll contemplate how to set up and configure MPIO on Windows Server …

Leave a Reply

Your email address will not be published. Required fields are marked *