Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Manage Print Queues Using PowerShell on Windows

The "Out-Printer" cmdlet is a PowerShell command used to send output directly to a printer. However, this cmdlet is not applicable in the Windows environment as it is specific to PowerShell on Windows Server and Windows 10/11. Instead, Windows offers several powerful tools and cmdlets to manage print queues and printers effectively. This article will guide you through using PowerShell to manage print queues, add printers, and troubleshoot printing issues on a Windows machine.

Examples:

  1. Listing All Printers: To list all printers installed on your Windows machine, you can use the Get-Printer cmdlet.

    Get-Printer
  2. Adding a New Printer: To add a new printer, use the Add-Printer cmdlet. Here’s an example of adding a network printer.

    Add-Printer -Name "OfficePrinter" -DriverName "HP Universal Printing PCL 6" -PortName "IP_192.168.1.100"
  3. Removing a Printer: To remove a printer, use the Remove-Printer cmdlet.

    Remove-Printer -Name "OfficePrinter"
  4. Printing a Test Page: To print a test page, you can use the Invoke-Expression cmdlet to call the rundll32 command.

    Invoke-Expression -Command "rundll32 printui.dll,PrintUIEntry /k /n \"OfficePrinter\""
  5. Managing Print Queues: To list all print jobs in a specific printer’s queue, use the Get-PrintJob cmdlet.

    Get-PrintJob -PrinterName "OfficePrinter"
  6. Removing a Print Job: To remove a specific print job, use the Remove-PrintJob cmdlet.

    Remove-PrintJob -PrinterName "OfficePrinter" -ID 12
  7. Setting Default Printer: To set a default printer, use the Set-PrintConfiguration cmdlet.

    Set-PrintConfiguration -PrinterName "OfficePrinter" -Default
  8. Troubleshooting Printer Issues: To troubleshoot printer issues, you can use the Get-EventLog cmdlet to check for any related errors in the event logs.

    Get-EventLog -LogName System -Source PrintService

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.