Printing PDF in PowerShell

Posted on 2011-05-02
Last Modified: 2012-05-11
I'm using the following cmdlet: Get-ChildItem  -path c:\temp\pdf -filter myform.pdf | Get-Content | Out-Printer to print a PDF document. For some reason it doesn't print out the PDF document properly, it prints is out in ASCII format or garbage. I'm I missing something?
Question by:7of9121098
    LVL 14

    Expert Comment

    by:Dhiraj Mutha
    Try this, it will print all the pdf in the folder.

    Dir D:\test\*.pdf | Foreach-Object { Start-Process -FilePath $_.FullName –Verb Print }

    If you want a specific pdf, try this.

    Dir D:\test\myform.pdf | Foreach-Object { Start-Process -FilePath $_.FullName –Verb Print }


    Author Comment

    Hi pspqlb, it worked perfect, you get the points, one quick question. I got the following cmdlet that displays a list of printers on a server from a workstation. It prompts me for a username and password. Is is possible to empbedded the username and password in the cmdlet statement?
    If so how, thanks.

    $server= "myserver"
    Get-WMIObject Win32_Printer -ComputerName $server -credential
    (Get-Credential) | foreach-object{$_.Name}

    LVL 14

    Accepted Solution


    Author Closing Comment

    LVL 14

    Expert Comment

    by:Dhiraj Mutha
    Thanks for the grade.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article is intended to be a 2 part Primer to get someone up and running quickly and efficiently in Powershell, but also including small useful tips that you might not find elsewhere.   One of the things I see often is people starting out usi…
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now