Windows Tip Sheet

Prints Charming

Slay the documentation dragon with a few of these nifty tricks.

I'm sure you've all heard the documentation mantra at one time or another. The challenge is finding time to do it. Well, depending on what you need to document, creating printed documentation on the fly is pretty easy. From a command prompt, all you need to do is redirect the console output to a printer:

dir > \\Print01\hplaser5

If your needs are a little more complex -- say you need to audit file permissions -- a command expression like this will get the job done (typed in a single line, of course):

(for /f %i in ('dir e:\users /b /s') do @cacls %i) > \\Print01\hplaser5

 

 

Tech Help—Just An
E-Mail Away

Got a Windows, Exchange or virtualization question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to the MCPmag.com editors at editor@mcpmag.com; the best questions get answered in this column and garner the questioner with a nifty Redmond T-shirt.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message, but submit the requested information for verification purposes.)

When complete, you'll have a printed report. It might be quite long, but you'll have it.

One drawback to command-line redirection is that you can't send a job to a USB-attached printer without using a third-party solution. However, if the printer is on LPT1, you can do something like this:

(for /f %i in ('dir *.exe /b') do @filever %i) > LPT1:

If you're using PowerShell, redirecting output to a printer is even easier. All you need to do is pipe the output to the Out-Printer cmdlet:

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

If you don't specify a printer name, output goes to the default printer. It doesn't matter if the default printer is network- or USB-based or on LPT1. If you want to specify a printer, use an expression like this:

get-service | where {$_.status -eq "stopped"} | out-printer -name \\jdhit-dc01\hplaser5

If you have a PDF driver installed, you can create digital documentation in a snap without lifting too many fingers:

get-childitem|get-acl |format-list |out-printer -name "Adobe PDF"

Now you can be the "Prints Charming" of your department, slay the evil documentation dragon and save the day.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus

SharePoint Watch

Sign up for our newsletter.

I agree to this site's Privacy Policy.