Setting advanced print settings

Hi all. I have an interesting thing I would like to do:
Change print settings on 5000 queue’s with a one-liner, ok perhaps two…
Here is what I can extract from the print settings from one of the queue’s :
$queue = “printerqueue_name”
[xml]$printTicket = Get-PrintConfiguration -PrinterName $queue | Select-Object -ExpandProperty PrintTicketXML
($printTicket.PrintTicket.ChildNodes | where name -Like psk:jobinputbin) = “ns0000:auto”

Set-PrintConfiguration -PrinterName $queue -PrintTicketXml $printTicket

The Idea behind this script is that I would like to change the inputbin from “ns0000:Cassette2” to “ns0000:Auto” - or whatever Cassette I would like to have for this queue.
But I get an error I think is quite generic :

Set-PrintConfiguration : Invalid at the top level of the document.
At line:6 char:1

  • Set-PrintConfiguration -PrinterName $pname -PrintTicketXml $printTicket
  •   + CategoryInfo          : InvalidArgument: (MSFT_PrinterConfiguration:ROOT/StandardCi...erConfiguration) [Set-PrintConfiguration], CimException
      + FullyQualifiedErrorId : HRESULT 0x80070057,Set-PrintConfiguration

It seems that it should be possible to edit the xml settings, and there is a lot of settings you can list out.
And if you change the Cassette setting in “advanced settings” on the queue, these changes are reflected immediately to the xml settings.
There are 2 different type of settings : PrintTicketXml and PrintCapabilitiesXml
Save the xml config to look at it in a browser :


Anyone with an Idea of how to do this?

This would be a lot simpler if you had a print server. You can set the default setting for the printer there and it would force the clients to be set to those settings.

I didn’t state that, but we have 4 print servers with all these queue’s.
My problem is that when i change print driver, also settings are changed, for example that Cassette1 and 3 are disabled for a print queue that is set to print from Cassette2.
There is also a variety of plotters, A3 printers and a heavenly mix of all kinds.
Imagine going through 5000 queue’s manually and set these things… And to make it more fun, settings aren’t named the same from one driver version to the other… But that is a matter of logic in script. This is also useful for those migrating from ex windows2003 x32 to server2012 x64… I know there are data that can be modified in registry, but not sure if it is the best way to configure queues. So my question is this : Is there a .Net or C++ way to configure printqueue’s in Powershell?

What operating system are your print servers? 2008 R2? 2012 R2? 2003? (please don’t say yes to this haha)

I’ve done printer security on queues before, was thinking there may be a way to do what you’re asking… but there might not be.

That being said… I’m using 2012 R2. There is a System.Printing type you can use to get quite a bit of detail. I assume with some testing you may be able to get this to work by setting the ‘InputBin’ to something other than ‘AutoSelect’ (actually a value of 1) from what I can see.

Add-Type -AssemblyName System.Printing
$permissions = [System.Printing.PrintSystemDesiredAccess]::AdministrateServer
$queueperms = [System.Printing.PrintSystemDesiredAccess]::AdministratePrinter
$server = new-object System.Printing.PrintServer -argumentList $permissions
$queues = $server.GetPrintQueues(@([System.Printing.EnumeratedPrintQueueTypes]::Shared))

###  I then looked for one specific queue called LB_HP8150 as it's all I had on my test box.

$HPPrinter = ($queues | where {$ -eq "LB_HP8150"})

### The above line returns a value of 1.   My understanding is that the InputBin is the input where blank paper is pulled from.   My printer is set to AutoSelect.  

i have to leave so I haven’t actually tried SETTING the value… but thought maybe this would help. Let me know