PRNMNGR - CMD


Overview

The PRNMNGR command is a print manager command-line utility used in Windows to add, remove, and manage printers from a command prompt. Designed primarily for use in batch files and scripts, PRNMNGR allows administrators to automate printer management tasks in various environments, such as in offices with multiple printers or on servers that manage networked printers.

Syntax

The basic syntax for PRNMNGR is as follows:

PRNMNGR -a | -d | -l | -m | -t | -r | -p | -h | -o get | -o list | -o set | -x [-s <ServerName>] [-c <ComputerName>] [-p <PrinterName>] [-m <DriverName>] [-r <PortName>] [-u <UserName>] [-w <Password>]
  • -a: Add a printer.
  • -d: Delete a printer.
  • -l: List printers.
  • -m: Set the default printer.
  • -t: Print a test page.
  • -r: Rename a printer.
  • -p: Purge a printer.
  • -h: Set printer as hidden.
  • -o: Operation on a printer (get, list, set, clear).
  • -x: XML output.
  • -s: Specifies the server name.
  • -c: Specifies the computer name.
  • -p: Specifies the printer name.
  • -m: Specifies the driver name.
  • -r: Specifies the port name.
  • -u: Specifies the user name for authentication.
  • -w: Specifies the password for authentication.

Options/Flags

  • -a: Adds a new printer to the system. Requires -p, -m, and -r flags.
  • -d: Deletes an existing printer. Needs the -p flag.
  • -l: Lists all printers available on the specified server or local machine.
  • -m: Sets a printer as the default printer. It requires the -p flag.
  • -t: Prints a test page to verify printer operation. Needs -p.
  • -r: Renames an existing printer. Requires old and new printer names.
  • -p: Clears all print jobs from the specified printer queue.
  • -h: Sets a printer setting to hidden.
  • -o: Performs various operations on the printer like getting or setting configuration.
  • -x: Generates output in XML format for easier parsing in scripts.

Examples

Example 1: Adding a printer

PRNMNGR -a -p "Printer_Name" -m "Driver_Name" -r "Port_Name"

Example 2: Deleting a printer

PRNMNGR -d -p "Printer_Name"

Example 3: Setting the default printer

PRNMNGR -m -p "Printer_Name"

Example 4: Listing all printers

PRNMNGR -l

Common Issues

  • Permission Errors: Ensure you have administrative privileges when modifying printer settings.
  • Incorrect Parameters: Double-check printer names, driver names, and port names for typos to avoid errors.
  • Driver Compatibility: Ensure the printer driver is compatible with your system.

Integration

PRNMNGR can be used in combination with FOR loops to perform actions on multiple printers. For example:

FOR %i IN (Printer1, Printer2) DO PRNMNGR -d -p "%i"

This command will delete Printer1 and Printer2 from the system.

  • PRINTUI: A command-line tool that provides similar functionalities with a graphical user interface.
  • NET PRINT: View and manage print jobs.

For more information, visit the official Microsoft documentation page for printer management commands or the Microsoft Technet forums for community-driven support.