Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

The Set-PrintConfiguration cmdlet sets the printer configuration for the specified printer. Using the Set-PrintConfiguration cmdlet, you can manage the configuration of the following features:

  • Collate
  • Color
  • Duplexing Mode
  • N-Up
  • Paper Size

NOTE: You need administrator credentials to use Set-PrintConfiguration.

$PrinterSettings = new-object System.Drawing.Printing.PrinterSettings
ECHO $PrinterSettings
CanDuplex           : True
Copies              : 1
Collate             : True
DefaultPageSettings : [PageSettings: Color=True, Landscape=False, Margins=[Margins 
                      Left=100 Right=100 Top=100 Bottom=100], PaperSize=[PaperSize Letter 
                      Kind=Letter Height=1100 Width=850], PaperSource=[PaperSource 
                      Automatically Select Kind=FormSource], 
                      PrinterResolution=[PrinterResolution X=360 Y=360]]
Duplex              : Simplex
FromPage            : 0
IsDefaultPrinter    : True
IsPlotter           : False
IsValid             : True
LandscapeAngle      : 270
MaximumCopies       : 999
MaximumPage         : 9999
MinimumPage         : 0
PrintFileName       : 
PaperSizes          : {[PaperSize Letter Kind=Letter Height=1100 Width=850], [PaperSize A4 
                      Kind=A4 Height=1169 Width=827], [PaperSize 102 x 152 mm (4 x 6 in) 
                      Kind=Custom Height=600 Width=400], [PaperSize 89 x 127 mm (3.5 x 5 
                      in) Kind=Custom Height=500 Width=350]...}
PaperSources        : {[PaperSource Automatically Select Kind=FormSource]}
PrintRange          : AllPages
PrintToFile         : False
PrinterName         : NABV001
PrinterResolutions  : {[PrinterResolution High], [PrinterResolution Medium], 
                      [PrinterResolution Low], [PrinterResolution Draft]...}
SupportsColor       : True
ToPage              : 0
$DefaultPrinter = Get-WmiObject -Query " SELECT * FROM Win32_Printer WHERE Default=$true" | Select -Expand Name
$PrinterOpts = Get-PrintConfiguration -PrinterName "Microsoft XPS Document Writer"
$PrinterOpts = Get-PrintConfiguration -PrinterName $DefaultPrinter
ECHO $PrinterOpts
PrinterName     ComputerName    Collate    Color      DuplexingMode       
-----------     ------------    -------    -----      -------------       
FSWS001                         True       True       OneSided  
$PrinterOpts .DuplexingMode = "TwoSidedLongEdge"
$PrinterOpts .PaperSize = "Letterhead"
$PrinterOpts .DuplexingMode = "TwoSidedLongEdge"
$PrinterOpts .PaperSize = "Letterhead"
At line:1 char:14
+ $PrinterOpts .DuplexingMode = "TwoSidedLongEdge"
+              ~~~~~~~~~~~~~~
Unexpected token '.DuplexingMode' in expression or statement.
At line:2 char:14
+ $PrinterOpts .PaperSize = "Letterhead"
+              ~~~~~~~~~~
Unexpected token '.PaperSize' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
Set-PrintConfiguration $DefaultPrinter -DuplexingMode TwoSidedLongEdge -PaperSize Letterhead
Set-PrintConfiguration $DefaultPrinter -DuplexingMode TwoSidedLongEdge -PaperSize Letterhead
Set-PrintConfiguration : Cannot process argument transformation on parameter 'PaperSize'. 
Cannot convert value "Letterhead" to type 
Error: "Unable to match the identifier name Letterhead to a valid enumerator name. Specify 
one of the following enumerator names and try again:
Custom, Letter, LetterSmall, Tabloid, Ledger, Legal, Statement, Executive, A3, A4, 
A4Small, A5, B4, B5, Folio, Quarto, Sheet10x14, Sheet11x17, Note, Envelope9, Envelope10, 
Envelope11, Envelope12, Envelope14, CSheet, DSheet, ESheet, EnvelopeDL, EnvelopeC5, 
EnvelopeC3, EnvelopeC4, EnvelopeC6, EnvelopeC65, EnvelopeB4, EnvelopeB5, EnvelopeB6, 
EnvelopeItaly, EnvelopeMonarch, EnvelopePersonal, FanfoldUS, FanfoldStandardGerman, 
FanfoldLegalGerman, ISOB4, JapanesePostcard, Sheet9x11, Sheet10x11, Sheet15x11, 
EnvelopeInvite, Reserved48, Reserved49, LetterExtra, LegalExtra, TabloidExtra, A4Extra, 
LetterTransverse, A4Transverse, LetterExtraTransverse, APlus, BPlus, LetterPlus, A4Plus, 
A5Transverse, B5Transverse, A3Extra, A5Extra, B5Extra, A2, A3Transverse, 
A3ExtraTransverse, JapaneseDoublePostcard, A6, JapaneseEnvelopeKaku2, 
JapaneseEnvelopeKaku3, JapaneseEnvelopeChou3, JapaneseEnvelopeChou4, LetterRotated, 
A3Rotated, A4Rotated, A5Rotated, B4JISRotated, B5JISRotated, JapanesePostcardRotated, 
JapaneseDoublePostcardRotated, A6Rotated, JapaneseEnvelopeKaku2Rotated, 
JapaneseEnvelopeKaku3Rotated, JapaneseEnvelopeChou3Rotated, JapaneseEnvelopeChou4Rotated, 
B6JIS, B6JISRotated, Sheet12x11, JapaneseEnvelopeYou4, JapaneseEnvelopeYou4Rotated, 
PRC16K, PRC32K, PRC32KBig, PRCEnvelope1, PRCEnvelope2, PRCEnvelope3, PRCEnvelope4, 
PRCEnvelope5, PRCEnvelope6, PRCEnvelope7, PRCEnvelope8, PRCEnvelope9, PRCEnvelope10, 
PRC16KRotated, PRC32KRotated, PRC32KBigRotated, PRCEnvelope1Rotated, PRCEnvelope2Rotated, 
PRCEnvelope3Rotated, PRCEnvelope4Rotated, PRCEnvelope5Rotated, PRCEnvelope6Rotated, 
PRCEnvelope7Rotated, PRCEnvelope8Rotated, PRCEnvelope9Rotated, PRCEnvelope10Rotated"
At line:1 char:83
+ ... $DefaultPrinter -DuplexingMode TwoSidedLongEdge -PaperSize Letterhead
+                                                                ~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Set-PrintConfiguration], ParameterBindingA 
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-PrintConfiguration

  • No labels