Set Paper Source Powershell

HinW 20 Reputation points
2023-02-16T02:01:49.5533333+00:00

I am trying to set Paper Source to Tray 1 to print A4 in with powershell script but seems like I cannot find any method for it.

Can we do it with Set-PrintConfiguration method?

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,526 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,336 Reputation points
    2023-02-16T12:04:20.8866667+00:00
    
    Hello there,
    
    Here is how to change the set paper source in the settings object:
    
    PS C:\scripts> $settings = [System.Drawing.Printing.PrinterSettings]::new()
    PS C:\scripts> $settings.DefaultPageSettings.PaperSource
    
             Kind RawKind SourceName
             ---- ------- ----------
    AutomaticFeed       7 Auto Select
    
    
    PS C:\scripts> $settings.PaperSources
    
             Kind RawKind SourceName
             ---- ------- ----------
    AutomaticFeed       7 Auto Select
           Manual       4 Manual Feed
            Upper       1 Tray 1
           Middle       3 Tray 2
            Lower       2 Tray 3
    
    
    PS C:\scripts> $settings.DefaultPageSettings.PaperSource = $settings.PaperSources[2]
    PS C:\scripts> $settings.DefaultPageSettings.PaperSource
    
     Kind RawKind SourceName
     ---- ------- ----------
    Upper       1 Tray 1
    
    
    PS C:\scripts>
    
    Similar discussion here https://social.technet.microsoft.com/Forums/en-US/1394962d-d195-4847-9df8-27059b81473b/powershell-setting-papersourcetray-for-a-printer?forum=ITCG
    
    Hope this resolves your Query !!
    
    --If the reply is helpful, please Upvote and Accept it as an answer--
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.