Set Default Printer Windows 10 Command Line

Set Default Printer Windows 10 Command Line

Today we’ll talk most opportunities of managing printers and their drivers from the command prompt in Windows x/ 8.1 and Windows Server 2012 R2/ 2016. We volition consider how to install a new local or network printer, impress driver, create a TCP/IP print port, print a test page, delete a commuter or printer using simple Windows commands. Information technology can be useful in various scenarios unattended printer installation in SCCM tasks, logon scripts of the group policies and on the servers running in the Server Core manner.

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

To manage printers, Microsoft has developed several VBS scripts that let you to manage printers and print queues, install and uninstall printer drivers, etc.

These scripts are present in all Windows versions (starting from Vista and Windows Server 2008) and are located in the directory
C:\Windows\System32\Printing_Admin_Scripts\en-US.


Annotation
.

  1. Instead of
    en-U.s.
    directory, there tin be another directory corresponding to the system language;
  2. In Windows XP and 2003 these VBS scenarios are stored in the C:\WINDOWS\system32 directory.


vbs script for manage printers and drivers in windows 8

The following VBS scripts are located in this folder:

  • Prncnfg.vbs
    – a script to display information near the printer settings;
  • Prndrvr.vbs
    – printer driver management (install / uninstall printer drivers);
  • Prnjobs.vbs
    – managing print jobs;
  • Prnmngr.vbs
    – managing printers (including creating and removing printer in the organisation);
  • Prnport.vbs
    – managing connection to the remote printer via TCP/IP ports;
  • Prnqctl.vbs
    – print queue management;
  • Pubprn.vbs
    – managing printer publishing in Agile Directory.
Read:  Spesifikasi Printer Hp Ink Tank Wireless 415

Note.
One of the well-known ways of managing printers in different versions of Windows is the host process
rundll32.exe, which receives the name of the library
printui.dll
and the entry indicate to it (PrintUIEntry). The control
rundll32 printui.dll,PrintUIEntry
is enough to perform basic operations with printers and is fully supported by Microsoft, but the use of specified vbs scripts is preferable from the administrator indicate of view.

Let’s consider typical scenarios of using these VBS scripts.

How to Install a Printer Driver from the Command Line?

Permissions to install and configure local printers are available for members of the following local groups: Administrators, Print Operators or Server groups.

Install the HP printer driver using the command:
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-U.s.a.\prndrvr.vbs" -a -k "HP Universal Printing PCL 6" -i "C:\drv\HP Universal Print Driver\hpcu160u.inf"


install printer driver from command prompt
Allow’s consider the parameters of the command:

-a
– add together printer commuter;

-m “HP Universal Printing PCL vi”– the name of the printer driver;

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

Later the driver is installed, it appears in the impress server backdrop (Command Console\Hardware and Sound\Devices and Printers ->
Print Server Properties).


list of installed print drivers in windows

Note. If you are using an incompatible printer driver, you can install information technology
manually.

How to Add a New Printer from the Command Prompt?

Using the post-obit command, you can install a new printer named HP5525 using the previously installed HP Universal Press PCL vi impress commuter:
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" -a -p "HP5520" -grand "HP Universal Press PCL six" -r "lpt1:"


install printer from cmd in windows 8/2012

-a
– a new local printer is installed;

-p “HP5520”
– a display proper noun of the printer;

-m “HP Universal Printing PCL vi”
– a print driver that is used;

-r “lpt1:”
– a name of the local print port used. In this example, press should be performed through the LPT port. Hither you tin can specify the parallel port (LPT1:, LPT2:), serial (COM1:, COM2: – before installation, brand sure that this
COM port is non used
by another device) or USB port (USB001, etc.).

Read:  Brother Printer Paper Jam but No Paper

Managing Default Printer Using CMD

From the command line, you tin choose which printer to use for default printing. With the following command yous can list all installed printers:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" –fifty

Yous can get the proper noun of the current default printer:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-Usa\prnmngr.vbs" –g


Managing Default Printer Using CMD

The default printer is HP Universal Printing PCL half-dozen (redirected one)

To gear up a different default printer, run the command:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-Us\prnmngr.vbs" -t –p "HP5525"

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

If y’all want to connect a network printer, y’all must outset create a TCP/IP printer port for information technology (suppose the printer IP address is 192.168.i.22):
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\Prnport.vbs" -a -r IP_192.168.i.22 -h 192.168.1.22 -o raw -n 9100

-r IP_192.168.i.22
– a proper noun of the network port;

-h 192.168.one.22
– IP address of the device;

-o raw
– a port type (raw or lpr);

-due north 9100
– the number of the TCP port of the device (usually 9100).

And then y’all can install a new network printer on the system:
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-Usa\prnmngr.vbs" -a -p "HP5525" -m "HP Universal Printing PCL vi" -r " IP_192.168.i.22"

Later the script is over, a new printer HP5525 appears in the system.


just installed printer apear in system

How to Print a Test Page from the CMD?

To print a exam page on the printer you have created, do the post-obit:
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-United states\prnqctl.vbs” -e -p "HP5525"

Manage Impress Queues from the Command Prompt

Using the prnjobs.vbs script, you can view impress jobs in queues. To display all print jobs for all local printers, run the command:
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnjobs.vbs” –l

To display jobs on a specific printer, you lot need to specify its proper name:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-United states\prnjobs.vbs” –50 –p HP5525

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

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-Us\prnjobs.vbs” –ten –p HP5525

Or you tin can apace clear all queues for all printers (this is much more convenient than manually cleaning the print queues):

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnjobs.vbs” –x

Share a Network Printer Using the Control Line

All new printers that y’all installed in Windows from the command prompt are local. You tin share them with other users over the network from the Windows GUI (meet the
article). You can also share the printer from the command line. For example, you want to provide network access to your HP5525 printer past publishing it under the name HP5525_Shared. Use the command:

Read:  Cara Setting Printer Epson L210 Yang Tidak Bisa Ngeprint

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-U.s.\prncnfg.vbs” -t  -p  HP5525 -h "HP5525_Shared" +shared

To disable printer sharing, run:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-U.s.a.\prncnfg.vbs” -t -p "HP5525" -shared

Similarly, you can publish a printer in Agile Directory:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prncnfg.vbs” -t  -p HP5525 +published

To remove printer from the Ad, utilise the “-published” argument.

How to Add together a Network Printer via the Command Line?

To connect a shared network printer continued to another estimator, apply the
command:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-The states\prnmngr.vbs" -ac -p “\\rome-prnt01\hp2100”

Quite frequent errors when connecting network printers –
0x00000002,
0x00000057
and
0x0000007e. Ways to solve errors are available at the links to a higher place.

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

A complete listing of printers in the system can be displayed as:

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-United states of america\prnmngr.vbs" -fifty

A printer tin can exist removed with the following control:
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-Usa\prnmngr.vbs" -d -p "HP5525"

The print commuter is deleted every bit follows:
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-Us\prndrvr.vbs" -d -thou "HP Universal Printing PCL half-dozen" -eastward "Windows x64" -5 3

In this commodity we looked the basic operations with skillful old Microsoft VBS scripts that allow to manage printers and their drivers from the control line in various Windows versions. A complete listing of the capabilities and arguments of these scripts are available in Microsoft documentation or in the in-built help of the scenarios (just run the script file without parameters in the command line).

In the
next commodity

we will introduce a new opportunities of printer management in Windows 10 / 8.one and Windows Server 2016 / 2012 R2 provided past PowerShell.

Set Default Printer Windows 10 Command Line

You May Also Like