Set the Default Printer from PowerShell
Point Windows' default printer at the device you actually use, via the WScript.Network COM object.
01Command
$ (New-Object -ComObject WScript.Network).SetDefaultPrinter("HP LaserJet 1020")02What it does
When a shared office printer or an old PDF tool steals the default slot, every print dialog opens on the wrong device. The WshNetwork COM object has exposed SetDefaultPrinter since the XP era and still works in Windows 11, making it a reliable one-liner for scripts and login tasks. The name must match the printer's displayed name exactly — run Get-Printer to copy it. Note that Windows' "let Windows manage my default printer" setting will override this the next time you print somewhere else, so turn that off in Settings > Bluetooth & devices > Printers if you want the choice to stick.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- WshNetwork Object — SetDefaultPrinterEvidence: Documents WScript.Network's SetDefaultPrinter method, callable from PowerShell via New-Object -ComObject.
Last verified: 2026-09-18 · Category: System & Settings
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
Create or update a .zip from any files or folder contents straight from PowerShell.
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.