Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Printing from PowerShell

Posted on June 6, 2006October 16, 2009

PowerShell has a slick feature that allows you to send the output from a cmdlet or expression directly to a printer. Pipe the output to the Out-Printer cmdlet and it will print out on the default printer:

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

get-process | out-printer

If you have other printers installed you can use the printer name. For example, I have Adobe Acrobat installed which installs a virtual printer. I can send the output of a command to that printer and generate a pdf:

get-service |where {$_.status -eq "stopped"} |out-printer "Adobe PDF"

If you want to print to a network printer, specify the printer UNC:

get-service |where {$_.status -eq "stopped"} |out-printer "\\Print01\HPLaserJ"

(By the way, you don't have to wrap the printer name in quotes, but I find it a good practice to avoid any confusion, especially when the printer name might have quotes.)

This is also a quick way to print the contents of text files directly from within PowerShell:

get-content c:\boot.ini |out-printer "\\Print01\hplaserj"

There's no page numbering or formatting options but it is a quick way to get a hard copy of you results.

Technorati Tags:
PowerShell
Scripting


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

1 thought on “Printing from PowerShell”

  1. Hotel key card printing says:
    July 21, 2008 at 7:34 am

    Hi,

    It seems to be a good feature from PowerShell.

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d