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:
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
Hi,
It seems to be a good feature from PowerShell.