This post was most recently updated on September 21st, 2021.
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. 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: 2 minutes.
How to change printer paper size using PowerShell?
- 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 - 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: - 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"
- (OPTIONAL): Update the paper size for ALL of your printers
Let’s just make this a one-liner:
Get-Printer | Set-PrintConfiguration -PaperSize A4
- 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 }
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.
References
- Installing various versions of PowerShell
- Get-PrintConfiguration
- Set-PrintConfiguration
- These guys tried to figure this out, but the thread ain’t open anymore. So here you go.
- How to fix disconnected Sonoff Zigbee sensors in Home Assistant? - January 24, 2023
- How to fix all UWP/WinUI apps being laggy in Windows 10/11? - January 17, 2023
- How to export the SSL/TLS certificate from a website using PowerShell? - January 10, 2023