How can I force Word and Excel to use the duplex mode set in PowerShell?
Asked by
MellowQuartz42
I need to print different documents with different settings: some single-sided and others double-sided. However, Word and Excel seem to use the printer driver's settings from the print dialog instead of the duplex mode I configure with PowerShell. How can I reliably control the duplex setting for each print job?
Answers
For drivers that support it, you can modify the printer's PrintTicket XML directly. Start by retrieving the configuration and parsing its XML, then locate the duplex feature and replace its value before applying it again. The exact feature names depend on the printer, but common values are `psk:OneSided`, `psk:TwoSidedLongEdge` for flip-over duplexing, and `psk:TwoSidedShortEdge` for flip-up duplexing. For example, you can replace `psk:OneSided` with `psk:TwoSidedShortEdge` and pass the updated XML to Set-PrintConfiguration. A compatible PCL6 v4 or universal driver may be required.
Reply to this answer
Printing configuration varies substantially between manufacturers and driver models. If the application supplies its own print-ticket settings, those can override the printer's stored defaults. In practice, success often depends on installing the correct vendor or universal driver and inspecting the printer's supported PrintTicket features rather than relying only on Set-PrintConfiguration.
Reply to this answer
The printer driver's settings may take precedence over values changed with Set-PrintConfiguration. Windows printing can have several layers of defaultsโglobal printer defaults, per-user defaults, and settings for the current print sessionโand applications do not always resolve them the same way. Set-PrintConfiguration may also behave differently depending on the driver type, so the driver and application could be overriding the PowerShell setting.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowQuartz42: This worked reliably with my older HP printer, which used a PostScript driver. The newer Brother driver behaves differently: it ignores the PowerShell setting, and the Word COM interface does not expose an API for selecting duplex mode per print job.