question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bring back Out-Printer

See original GitHub issue

Summary of the new feature/enhancement

‘As a user I want to be able to send output of a command to a printer.’ For example Get-Process | out-printer "OneNote" would save the current processes to a new page in OneNote or Get-Package | lp Would send a list packages to the default printer

Proposed technical implementation details

Windows PowerShell has an Out-Printer command with an alias of lp . but this was dropped in PowerShell core V6 I have posted a version for V6 and later at https://www.powershellgallery.com/packages/6print with a repo at https://github.com/jhoneill/6Print

This provides some additional controls over the output. I’d propose this as a first draft / worked example of how it could be done.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

2reactions
jhoneillcommented, Oct 2, 2019

@iSazonov Yes. Completely agree, cmdlets should work on all supported OSes, but this a should, not a must. We already have a Printer Management module which manages printer drivers, settings, queues and jobs (and it might make sense to out Out-Printer to this module). But this module only understands Windows print-devices, print-queues and print-jobs; Unix-based OSes have their own command line tools for managing these, Windows didn’t have until PowerShell added them (and the “Print” command which has been around since DOS, is still in CMD but only sends a printer ready file to a port name like “PRN” or “LPT2” so is effectively “broken”) .

  • My understanding of Linux isn’t the best but AIUI you can docommand | lp and send Output to the printer.
  • Windows PowerShell 5 has Out-Printer with an alias of lp so you can do command | lp and send Output to the printer.
  • The only place where command | lp doesn’t work is on PowerShell core when running on Windows.

The idea is to plug that gap. Having something missing from some OSes is undesirable, but having something which was in Windows PowerShell 5 missing in 7 is probably worse - especially as any linux shell, including pwsh can print using | lp , which is their solution until the .NET portable subset gets printing support.

0reactions
msftbot[bot]commented, Nov 21, 2019

🎉This issue was addressed in #10906, which has now been successfully released as v7.0.0-preview.6.🎉

Handy links:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Putting Out-Printer back into PowerShell 6.1
So I thought I would try to put it back. The result is named 6Print and you can install it from the PowerShell...
Read more >
Out-Printer - PowerShell
Out-Printer. Send output to a printer. Syntax Out-Printer [[-name] string] [-inputObject psobject] [CommonParameters] Key -name string The printer name, ...
Read more >
Out-printer cmdlet | Greg's Blog - WordPress.com
To print a word or pdf document you need to use this command. Start-Process -FilePath “C:\Test.Docx” -Verb Print. Which brings you back to...
Read more >
Old pushed out printer issue : r/sysadmin
I've checked group policy and anything to do with pushing out these printers is gone. The old DC02 server is long gone and...
Read more >
Out-Printer (Microsoft.PowerShell.Utility)
The Out-Printer cmdlet sends output to the default printer or to an alternate ... Get-Content gets the contents of the readme.txt file in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found