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

How to change printer paper size using PowerShell?

This post was most recently updated on February 18th, 2023.

3 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. This is very useful if you have multiple printers and multiple computers that you use. 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 that 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

Time needed: 5 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 their paper sizes. Let’s set the offending printer straight somewhat like this:

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

    Even if you get some access denied errors, it doesn’t mean your change hasn’t gone through. Jump to step 5 to verify!

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

    You can also just set all of your printers to use the proper, German standard paper size. 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 printers 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 documenting 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.

And as a side note – if you get these errors:

Set-PrintConfiguration : Access was denied to the specified resource.
At line:1 char:15
+ Get-Printer | Set-PrintConfiguration -PaperSize A4
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (MSFT_PrinterConfiguration:ROOT/StandardCi...erConfiguration) [Set-Pri
   ntConfiguration], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070005,Set-PrintConfiguration
Set-PrintConfiguration : Access was denied to the specified resource.
At line:1 char:15
+ Get-Printer | Set-PrintConfiguration -PaperSize A4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (MSFT_PrinterConfiguration:ROOT/StandardCi…erConfiguration) [Set-PrintConfiguration], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070005,Set-PrintConfiguration

Have no fear! It’s probably nothing at all. Just verify that the change was successful, and you should be good.

References

mm
5 1 vote
Article Rating
Subscribe
Notify of
guest

3 Comments
most voted
newest oldest
Inline Feedbacks
View all comments