Printer's misbehaving? Nothing a bit of PowerShell wouldn't fix!

How to change printer paper size using PowerShell?

2 min read.

This article explains (with conveniently copy-pasteable code samples) how you can query your printers using PowerShell and modify properties, such as paper size, for one or more of them. Very useful, if you have multiple printers and multiple computers you use them from, AND if you frequently move between continents, you might face the same, totally typical and widespread issue:

Your favorite printer might default to using “Letter” paper size, but you’d really need to get it printed in that sweet, sweet “A4” instead. And boy, what a mess it is if you forget to change it when you’re printing!

Margins get messed up. It’s the worst.

So, how do you change the default paper size for a printer?

Well, it’s actually really easy to do manually. It’s so easy I’m not even going to go into the details. Just go to Settings > Printers and scanners > modify the printers one by one.

But you don’t want to change the default paper size by hand every time you move between continents – especially if you have multiple printers and multiple computers. So in comes PowerShell!

Solution

Table of Contents

Time needed: 2 minutes.

How to change printer paper size using PowerShell?

  1. Open PowerShell

    Should be easy enough. You should have 1 or more different PowerShell versions already installed on your machine, and any of them will do.

    Or, if you can’t find it, get it following the directions here:
    Installing various versions of PowerShell

  2. Enumerate your printers and see their paper sizes

    Okay, easy enough – just run this in your PowerShell instance:

    Get-Printer | Get-PrintConfiguration | foreach-object { Write-Host $_.PrinterName: $_.PaperSize }

    You COULD also just omit everything after “| foreach-object..”, and get a nicely formatted table – but you won’t get the paper size that way.

    Anyway – you should get something like this:
    How to query all printers on your machine using PowerShell

  3. Update the paper size for your printer

    Okay – so now we know the printer names and and their paper sizes. Let’s set the offending printer straight somewhat like this:

    Set-PrintConfiguration -PrinterName "Brother HL-2030 (LPR)" -PaperSize "A4"

  4. (OPTIONAL): Update the paper size for ALL of your printers

    Let’s just make this a one-liner:

    Get-Printer | Set-PrintConfiguration -PaperSize A4

  5. Verify your change was successful

    Just run the first thing again, and observe the output:

    Get-Printer | Get-PrintConfiguration | foreach-object { Write-Host $_.PrinterName: $_.PaperSize }

    Output from querying all of your printers using PowerShell.

That’s it. The above should help you set the default paper size for one or more printer in Windows 10. Use it to switch it between A4 and Letter every week if you wish :)

Happy printing!

Postface

You might’ve noticed the cheeky tone of this article. Well done!

See, I’m sassing myself for spending 5 minutes figuring out the PowerShell to (partially) automate a 1-minute task… And THEN spending 10 minutes to document it on my blog.

All for a task – printing – that I need to do roughly once a year. Today marked the second time I needed to print since I’ve moved back to Finland in 2019.

Oh well.

References

mm
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments