1

I'm trying to Disable Advanced Printing Features (RawOnly) with C#. I can list all printers:

foreach (string printer in PrinterSettings.InstalledPrinters)
{
    Console.WriteLine(printer);
}

I can Read RawOnly feature:

PrintQueueAttributes[] queueAttributes = { PrintQueueAttributes.RawOnly };
EnumeratedPrintQueueTypes[] enumerationFlags = { EnumeratedPrintQueueTypes.RawOnly };
LocalPrintServer printServer = new LocalPrintServer();
PrinterSettings settings = new PrinterSettings();
PrintQueueCollection printQueuesOnLocalServer = printServer.GetPrintQueues();
foreach (PrintQueue printer in printQueuesOnLocalServer)
{
     Console.WriteLine("\tThe printer " + printer.Name + "is Advanced Printing Features enabled" + printer.IsRawOnlyEnabled + "\n");
}
Console.WriteLine("Press enter to continue.");
Console.ReadLine();

But I don't know hot to Set RawOnly feature. Could you help me with that. Thank you.

Additional information about EnumeratedPrintQueueTypes https://msdn.microsoft.com/en-us/library/system.printing.enumeratedprintqueuetypes(v=vs.110).aspx

Additional information about PrintQueueAttributes https://msdn.microsoft.com/en-us/library/system.printing.printqueueattributes(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1

P.S. I do not want to use Win32_Printer Class, because there is some problems with that.

fapw
  • 185
  • 1
  • 2
  • 15
  • What kind of problems do you have with the Win32_Printer class? I'm not sure I know of any other way of setting the RawOnly feature. – Kaspar Kjeldsen Jul 07 '15 at 09:53
  • I've used that one with Powershell script on WS 2012 R2 Print Server. And for some reasons cannot execute that - no rights. Tried to run as Administrator, as System, with psexec -s and etc. Administrator, System accounts have rights on this printers. UAC is disabled. I can only uncheck this feature manually from Printer Properties.Thanks. – fapw Jul 07 '15 at 10:42

0 Answers0