Tag Archives: Print Que. Management

Pubprn.vbs

The pubprn.vbs command can be used to publish a printer to the Active Directory Domain Services. Similar to prncnfg.vbs and prnmngr.vbs, the Pubprn.vbs command is a Visual Basic script located in the %WINDIR%System32Printing_Admin_Scripts<language> directory. To use this command, at a command prompt, type cscript followed by the full path to the Pubprn.vbs file, or change directories to the appropriate folder.

Syntax (view syntax formatting guide):

Cscript Pubprn.vbs {<ServerName> | <UNCPrinterPath>} "LDAP://CN=<Container>,DC=<Container>"

Syntax Explanation

  • ServerName: Specifies the name of the Windows server that hosts the printer that you want to publish. If you do not specify a computer, the local computer is used.
  • UNCPrinterPath: The Universal Naming Convention (UNC) path to the shared printer that you want to publish.
  • “LDAP://CN=Container,DC=Container“: Specifies the path to the container in Active Directory Domain Services where you want to publish the printer.
  • /?: Displays help at the command prompt.

Explanation with Examples

To publish all printers on the \Server1 computer to the MyContainer container in the MyDomain.Company.Com domain:

cscript Ppubprn.vbs Server1 “LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com”

To publish the LaserPrinter1 printer on the \Server1 server to the MyContainer container in the MyDomain.Company.Com domain:

cscript Ppubprn.vbs \Server1LaserPrinter1 “LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com”

 

Prnqctl.vbs

The Prnqctl.vbs command is used to print a test pages, pause or resume a printer, and clear the printer queue. Similar to the prncnfg.vbs, prndrvr.vbs, prnjobs.vbs, prnmngr.vbs and prnport.vbs commands, the Prnqctl.vbs command is a Visual Basic script located in the %WINDIR%System32Printing_Admin_Scripts<language> directory. To use this command, at a command prompt, type Cscript followed by the full path to the Prnqctl.vbs file, or change directories to the appropriate folder.

Syntax (view syntax formatting guide):

Cscript Prnqctl {-z | -m | -e | -x | -?} [-s <ServerName>] [-p <PrinterName>] [-u <UserName>] [-w <Password>]

Syntax Explanation

  • -z: Pauses printing on the printer specified with the -p parameter.
  • -m: Resumes printing on the printer specified with the -p parameter.
  • -e: Prints a test page on the printer specified with the -p parameter.
  • -x: Cancels all print jobs on the printer specified with the -p parameter.
  • -s ServerName: Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
  • -p PrinterName: Specifies the name of the printer that you want to manage. Required.
  • -u UserName -w Password: Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer’s local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
  • /?: Displays help at the command prompt.

Explanation with Examples

To print a test page on the LaserPrinter1 printer shared by the \Server1 computer:

cscript Prnqctl -e -s Server1 -p LaserPrinter1

To pause printing on the LaserPrinter1 printer on the local computer:

cscript Prnqctl -z -p LaserPrinter1

To cancel all print jobs on the LaserPrinter1 printer on the local computer:

cscript Prnqctl -x -p LaserPrinter1

 

Prnport.vbs

The Prnport.vbs command is used to create, delete, and list standard TCP/IP printer ports, in addition to displaying and changing port configuration. Similar to the prncnfg.vbs, prndrvr.vbs, prnjobs.vbs and prnmngr.vbs, the Prnport.vbs command is a Visual Basic script located in the %WINDIR%System32Printing_Admin_Scripts<language> directory. To use this command, at a command prompt, type cscript followed by the full path to the Prnport.vbs file, or change directories to the appropriate folder.

Syntax (view syntax formatting guide):

Cscript prnport {-a | -d | -l | -g | -t | -?} [-r <PortName>] [-s <ServerName>] [-u <UserName>] [-w <Password>] [-o {raw | lpr}] [-h <HostAddress>] [-q <QueueName>] [-n <PortNumber>] -m{e | d} [-i <SNMPIndex>] [-y <CommunityName>] -2{e | -d}

Syntax Explanation

  • -a: Creates a standard TCP/IP printer port.
  • -d: Deletes a standard TCP/IP printer port.
  • -l: Lists all standard TCP/IP printer ports on the computer specified with the -s parameter.
  • -g: Displays the configuration of a standard TCP/IP printer port.
  • -t: Configures the port settings for a standard TCP/IP printer port.
  • -r PortName: Specifies the port to which the printer is connected.
  • -s ServerName: Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
  • -u UserName -w Password: Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer’s local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
  • -o {raw | lpr}: Specifies which protocol the port uses: TCP raw or TCP LPR. If you use TCP raw, you can optionally specify the port number by using the -n parameter. The default port number is 9100.
  • -h HostAddress: Specifies (by IP address) the printer for which you want to configure the port.
  • -q QueueName: Specifies the queue name for a TCP raw port.
  • -n PortNumber: Specifies the port number for a TCP raw port. The default port number is 9100.
  • -m{e | d}: Specifies whether SNMP is enabled. The parameter e enables SNMP. The parameter d disables SNMP.
  • -i SNMPIndex: Specifies the SNMP index, if SNMP is enabled. For more information, see RFC 1759 at the RFC Editor Web site (http://go.microsoft.com/fwlink/?LinkId=569).
  • -y CommunityName: Specifies the SNMP community name, if SNMP is enabled.
  • -2{e | -d}: Specifies whether double spools (also known as respooling) are enabled for TCP LPR ports. Double spools are necessary because TCP LPR must include an accurate byte count in the control file that is sent to the printer, but the protocol cannot get the count from the local print provider. Therefore, when a file is spooled to a TCP LPR print queue, it is also spooled as a temporary file in the system32 directory. TCP LPR determines the size of the temporary file and sends the size to the server running LPD. The parameter e enables double spools. The parameter d disables double spools.
  • /?: Displays help at the command prompt.

Explanation with Examples

To display all standard TCP/IP printing ports on the server \Server1:

cscript Prnport.vbs -l -s Server1

To delete the standard TCP/IP printing port on the server \Server1 that connects to a network printer at 10.2.3.4:

cscript Prnport.vbs -d -s Server1 -r IP_10.2.3.4

To add a standard TCP/IP printing port on the server \Server1 that connects to a network printer at 10.2.3.4 and uses the TCP raw protocol on port 9100:

cscript Prnport.vbs -a -s Server1 -r IP_10.2.3.4 -h 10.2.3.4 -o raw -n 9100

To enable SNMP, specify the “public” community name and set the SNMP index to 1 on a network printer at 10.2.3.4 shared by the server \Server1:

cscript Prnport.vbs -t -s Server1 -r IP_10.2.3.4 -me -y public -i 1 -n 9100

To add a standard TCP/IP printing port on the local computer that connects to a network printer at 10.2.3.4 and automatically get the device settings from the printer:

cscript Prnport.vbs -a -r IP_10.2.3.4 -h 10.2.3.4

 

Prnmngr.vbs

The Prnmngr.vbs command is used to add, delete, and list printers or printer connections. The prnmngr.vbs command can also be used to set and display the default printer. Similar to the prncnfg.vbs, prndrvr.vbs and prnjobs.vbs commands, the prndrvr.vbs command is a Visual Basic script located in the %WINDIR%System32Printing_Admin_Scripts<language> directory. To use this command, at a command prompt, type cscript followed by the full path to the Prnmngr.vbs file, or change directories to the appropriate folder

Syntax (view syntax formatting guide):

Cscript Prnmngr {-a | -d | -x | -g | -t | -l | -?}[c] [-s <ServerName>] [-p <PrinterName>] [-m <PrinterModel>] [-r <PortName>] [-u <UserName>] [-w <Password>]

Syntax Explanation

  • -a: Adds a local printer connection.
  • -d: Deletes a printer connection.
  • -x: Deletes all printers from the server specified with the -s parameter. If you do not specify a server, Windows deletes all printers on the local computer.
  • -g: Displays the default printer.
  • -t: Sets the default printer to the printer specified by the -p parameter.
  • -l: Lists all printers installed on the server specified by the -s parameter. If you do not specify a server, Windows lists the printers installed on the local computer.
  • c: Specifies that the parameter applies to printer connections. Can be used with the -a and -x parameters.
  • -s ServerName: Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
  • -p PrinterName: Specifies the name of the printer that you want to manage.
  • -m DriverModelName: Specifies (by name) the driver you want to install. Drivers are often named for the model of printer they support. See the printer documentation for more information.
  • -r PortName: Specifies the port where the printer is connected. If this is a parallel or a serial port, use the ID of the port (for example, LPT1: or COM1:). If this is a TCP/IP port, use the port name that was specified when the port was added.
  • -u UserName -w Password: Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer’s local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
  • /?: Displays help at the command prompt.

Explanation with Examples

To add a printer named ColorPrinter_2 that is connected to LPT1 on the local computer and requires a printer driver called Color Printer Driver1:

cscript Prnmngr.vbs -a -p ColorPrinter_2 -m “Color Printer Driver1” -r lpt1:

To delete the printer named ColorPrinter_2 from the remote computer named HRServer:

cscript Prnmngr.vbs -d -s HRServer -p ColorPrinter_2

 

Prnjobs.vbs

The Prnjobs.vbs command is used to pause, resume, cancel and list the print jobs in a specified print queue. Similar to the prncnfg.vbs and prndrvr.vbs command, the prnjobs.vbs command is a Visual Basic script located in the %WINDIR%System32Printing_Admin_Scripts<language> directory. To use the prnjobs.vbs command at the command prompts, type Cscript followed by the full path to the Prnjobs.vbs file, or change directories to the appropriate folder.

Syntax (view syntax formatting guide):

Cscript Prnjobs {-z | -m | -x | -l | -?} [-s <ServerName>]
[-p <PrinterName>] [-j <JobID>] [-u <UserName>] [-w <Password>]

Syntax Explanation

  • -z: Pauses the print job specified with the -j parameter.
  • -m: Resumes the print job specified with the -j parameter.
  • -x: Cancels the print job specified with the -j parameter.
  • -l: Lists all the print jobs in a print queue.
  • -s ServerName: Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
  • -p PrinterName: Specifies the name of the printer that you want to manage. Required.
  • -j JobID: Specifies (by ID number) the print job you want to cancel.
  • -u UserName -w Password: Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer’s local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
  • /?: Displays help at the command prompt.

Explanation with Examples

To pause a print job with a job ID of 27 sent to the remote computer named HRServer for printing on the printer named ColorPrinter, type:

Cscript Prnjobs.vbs -z -s HRServer -p ColorPrinter -j 27

To list all current print jobs in the queue for the local printer named ColorPrinter_2, type:

Cscript Prnjobs.vbs -l -p ColorPrinter_2

 

Prncnfg.vbs

The Prncnfg.vbs command is used to configure and display information about a printer. The Prncnfg.vbs command is actually a Visual Basic script located in the %WINDIR%System32Printing_Admin_Scripts<language> directory. So in order to use this command correctly you must first type cscript followed by the full path to the Prncnfg.vbs file, or change directories to the appropriate folder. The Prncnfg.vbs command is a very usefull tool for managing and maintaining the printers attached to local and remote computers using VB scripts.

 

Syntax (view syntax formatting guide):

Cscript Prncnfg {-g | -t | -x | -?} [-S <ServerName>] [-P <PrinterName>] [-z <NewPrinterName>] [-u <UserName>] [-w <Password>] [-r <PortName>] [-l <Location>] [-h <ShareName>] [-m <Comment>] [-f <SeparatorFileName>] [-y <Datatype>] [-st <StartTime>] [-ut <UntilTime>] [-i <DefaultPriority>] [-o <Priority>] [<+|->shared] [<+|->direct] [<+|->hidden] [<+|->published] [<+|->rawonly] [<+|->queued] [<+|->enablebidi] [<+|->keepprintedjobs] [<+|->workoffline] [<+|->enabledevq] [<+|->docompletefirst]

Syntax Explanation

  • -g: Displays configuration information about a printer.
  • -t: Configures a printer.
  • -x: Renames a printer.
  • -S <ServerName>: Specifies the name of the remote computer that hosts the printer that you want to manage. If you do not specify a computer, the local computer is used.
  • -P <PrinterName>: Specifies the name of the printer that you want to manage. Required.
  • -z <NewPrinterName>: Specifies the new printer name. Requires the -x and -P parameters.
  • -u <UserName> -w <Password>: Specifies an account with permissions to connect to the computer that hosts the printer that you want to manage. All members of the target computer’s local Administrators group have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work.
  • -r <PortName>: Specifies the port where the printer is connected. If this is a parallel or a serial port, then use the ID of the port (for example, LPT1 or COM1). If this is a TCP/IP port, use the port name that was specified when the port was added.
  • -l <Location>: Specifies the printer location, such as “Copy Room.”
  • -h <ShareName>: Specifies the printer’s share name.
  • -m <Comment>: Specifies the printer’s comment string.
  • -f <SeparatorFileName>: Specifies a file that contains the text that appears on the separator page.
  • -y <DataType>: Specifies the data types that the printer can accept.
  • -st <StartTime>: Configures the printer for limited availability. Specifies the time of day the printer is available. If you send a document to a printer when it is unavailable, the document is held (spooled) until the printer becomes available. You must specify time as a 24-hour clock. For example, to specify 11:00 P.M., type 2300.
  • -ut <EndTime>: Configures the printer for limited availability. Specifies the time of day the printer is no longer available. If you send a document to a printer when it is unavailable, the document is held (spooled) until the printer becomes available. You must specify time as a 24-hour clock. For example, to specify 11:00 P.M., type 2300.
  • -o <Priority>: Specifies a priority that the spooler uses to route print jobs into the print queue. A print queue with a higher priority receives all its jobs before any queue with a lower priority.
  • i <DefaultPriority>: Specifies the default priority assigned to each print job.
  • {+|-}shared: Specifies whether this printer is shared on the network.
  • {+|-}direct: Specifies whether the document should be sent directly to the printer without being spooled.
  • {+|-}published: Specifies whether this printer should be published in Active Directory. If you publish the printer, other users can search for it based on its location and capabilities (such as color printing and stapling).
  • {+|-}hidden: Reserved function.
  • {+|-}rawonly: Specifies whether only raw data print jobs can be spooled in this queue.
  • {+ | -}queued: Specifies that the printer should not begin to print until after the last page of the document is spooled. The printing program is unavailable until the document has finished printing. However, using this parameter ensures that the whole document is available to the printer.
  • {+ | -}keepprintedjobs: Specifies whether the spooler should retain documents after they are printed. Enabling this option allows a user to resubmit a document to the printer from the print queue instead of from the printing program.
  • {+ | -}workoffline: Specifies whether a user is able to send print jobs to the print queue if the computer is not connected to the network.
  • {+ | -}enabledevq: Specifies whether print jobs that do not match the printer setup (for example, PostScript files spooled to non-PostScript printers) should be held in the queue rather than being printed.
  • {+ | -}docompletefirst: Specifies whether the spooler should send print jobs with a lower priority that have completed spooling before sending print jobs with a higher priority that have not completed spooling. If this option is enabled and no documents have completed spooling, the spooler will send larger documents before smaller ones. You should enable this option if you want to maximize printer efficiency at the cost of job priority. If this option is disabled, the spooler always sends higher priority jobs to their respective queues first.
  • {+ | -}enablebidi: Specifies whether the printer sends status information to the spooler.
  • /?: Displays help at the command prompt.

Explanation with Examples

To display configuration information for the printer named ColorPrinter_2 with a print queue hosted by the remote computer named HRServer:

cscript Prncnfg.vbs -g -S HRServer -P ColorPrinter_2

To configure a printer named ColorPrinter_2 so that the spooler in the remote computer named HRServer keeps print jobs after they have been printed:

cscript Prncnfg.vbs -t -S HRServer -P ColorPrinter_2 +keepprintedjobs

To change the name of a printer on the remote computer named HRServer from ColorPrinter_2 to ColorPrinter 3:

cscript prncnfg.vbs -x -S HRServer -P ColorPrinter_2 -z “ColorPrinter 3”

Print

The Print command is used to add text files to a print queue. Because of limitations of text files it is not equal to the LP or LPR commands. The sole purpose of the Print command is simply to send a text file to a printer.

Syntax (view syntax formatting guide):

Print [/d:<PrinterName>] [<Drive>:][<Path>]<FileName>[ ...]

Syntax Explanation

  • /d:<PrinterName>: Specifies the printer that you want to print the job. To print to a locally connected printer, specify the port on your computer where the printer is connected.
    • Valid values for parallel ports are LPT1, LPT2, and LPT3.
    • Valid values for serial ports are COM1, COM2, COM3, and COM4.

You can also specify a network printer by using its queue name (\ServerNamePrinterName). If you do not specify a printer, the print job is sent to LPT1 by default.

  • <Drive>: Specifies the logical or physical drive where the file you want to print is located. This parameter is not required if the file you want to print is located on the current drive.
  • <Path>: Specifies the location of the file you want to print. This parameter is not required if the file you want to print is located in the current directory.
  • <FileName>[ …]: Required. Specifies the file you want to print. You can include multiple files in one command.
  • /?: Displays help at the command prompt.

Explanation with Examples

To send the file Report.txt in the current directory to a printer connected to LPT2 on the local computer:

print /d:lpt2 report.txt

To send the file Report.txt in the c:Accounting directory to the Printer1 print queue on the \CopyRoom server:

print /d:\copyroomprinter1 c:accountingreport.txt

 

Net Print

The Net Print command displays and controls information about specified printer ques and jobs. Note the Net Print command has been depreciated in Windows 7 and Server 2008. However, you can perform many of the same tasks included in the Net Print command through Prnj0bs.vbs, Windows Management Instrumentation (WMI), or through the use of the new Windows PowerShell cmdlets.

Syntax (view syntax formatting guide):

Net print {\<ComputerName><ShareName> |
\<ComputerName> <JobNumber> [/hold | /release | /delete]} [help]

Syntax Explanation

  • \ComputerNameShareName: Specifies (by name) the computer and print queue about which you want to display information.
  • \ComputerName: Specifies (by name) the computer that hosts the print job you want to control. If you do not specify a computer, the local computer is assumed. Requires the JobNumber parameter.
  • JobNumber: Specifies the number of the print job you want to control. This number is assigned by the computer that hosts the print queue where the print job is sent. After a computer assigns a number to a print job, that number is not assigned to any other print jobs in any queue hosted by that computer. Required when using the \ComputerName parameter.
  • [/hold | /release | /delete]: Specifies the action to take with the print job. The /hold parameter delays the job, allowing other print jobs to bypass it until it is released. The /release parameter releases a print job that has been delayed. The /delete parameter removes a print job from a print queue. If you specify a job number, but do not specify any action, information about the print job is displayed.
  • help: Displays help for the Net print command.

Explanation with Examples

This example shows how to list the contents of the Dotmatrix print queue on the \Production computer:

Net print \ProductionDotmatrix

This example shows how to display information about job number 35 on the \Production computer:

Net print \Production 35

This example shows how to delay job number 263 on the \Production computer:

Net Print \Production263 /hold

This example shows how to release job number 263 on the \Production computer:

Net print \Production 263 /release