<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: No Printers are Installed - Printtoprinter problem from Scheduled Task in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701997#M4376216</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don, thanks for your help.&amp;nbsp; I found out what the problem was.&amp;nbsp; This code below was not setting the printer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, at the times I tested it where it printed successfully (either in debug mode of the project or when double-clicking the compiled executable file), it was just using the default printer for the currently logged-in user.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked further and found the solution in this article: &lt;A href="https://scn.sap.com/thread/2099449"&gt;https://scn.sap.com/thread/2099449&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing from this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";&lt;/P&gt;&lt;P&gt;crystalReport.PrintToPrinter(1, true, 0, 0); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System.Drawing.Printing.&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Courier New;"&gt;PrinterSettings&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; printersettings = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; System.Drawing.Printing.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Courier New;"&gt;PrinterSettings&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;printersettings.PrinterName = PrinterToUse;&lt;/P&gt;&lt;P&gt;printersettings.Copies = 1;&lt;/P&gt;&lt;P&gt;printersettings.Collate = &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Report.PrintToPrinter(printersettings, &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; System.Drawing.Printing.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Courier New;"&gt;PageSettings&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;(), &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resolved my issue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone else reading this, if using the code above you get the error:&amp;nbsp; "Settings to access printer are not valid."&amp;nbsp; Use this bit of code on the machine where you plan on running the program to get the list of valid printers (if you're making a console application):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;foreach(string myPrinter in System.Drawing.Printing.PrinterSettings.InstalledPrinters){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(myPrinter);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Console.ReadLine();&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 May 2016 16:31:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2016-05-20T16:31:04Z</dc:date>
    <item>
      <title>No Printers are Installed - Printtoprinter problem from Scheduled Task</title>
      <link>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaq-p/11701993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm writing a console application in C# and I'm being required to print out Crystal Reports to a printer rather than email them.&amp;nbsp; When I test the application in debug mode, the reports print to the printer.&amp;nbsp; When I create an executable and put it out on a network drive, I'm able to get the reports to print.&amp;nbsp; When I log into a remote server using the administrator account and run the executable off the network drive, I'm able to get the reports to print.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I'm having is that when I try to run the executable as part of a scheduled task, I'm getting the "no printers are installed" error.&amp;nbsp; The scheduled task is being run under the domain administrator's account.&amp;nbsp; I set it to run even if the user isn't logged in (but we still leave the domain administrator's account logged into the server) and save the administrator's password with the scheduled task. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any idea of how I might resolve this?&amp;nbsp; Here's the offending code below, just in case anyone needs it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (isPrintedOut)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; crystalReport.PrintToPrinter(1, true, 0, 0); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2016 16:31:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaq-p/11701993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-05-10T16:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: No Printers are Installed - Printtoprinter problem from Scheduled Task</title>
      <link>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701994#M4376213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See this MS KKBA on how to expose User Printers to the System:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;184291" title="http://support.microsoft.com/default.aspx?scid=kb;en-us;184291"&gt;http://support.microsoft.com/default.aspx?scid=kb;en-us;184291&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2016 17:18:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701994#M4376213</guid>
      <dc:creator>former_member11696</dc:creator>
      <dc:date>2016-05-10T17:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: No Printers are Installed - Printtoprinter problem from Scheduled Task</title>
      <link>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701995#M4376214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried it, even though, I'm running a console app and not an ASP web page and the scheduled task is running using the domain administrator's account rather than the system account.&amp;nbsp; But the steps in that KB didn't resolve the issue. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 15:40:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701995#M4376214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-05-11T15:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: No Printers are Installed - Printtoprinter problem from Scheduled Task</title>
      <link>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701996#M4376215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use ProcessMonitor and see if thsoe registry keys are being read while your app is running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See if my printer app works for you, search for KBA 2163438.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2016 20:35:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701996#M4376215</guid>
      <dc:creator>former_member11696</dc:creator>
      <dc:date>2016-05-17T20:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: No Printers are Installed - Printtoprinter problem from Scheduled Task</title>
      <link>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701997#M4376216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don, thanks for your help.&amp;nbsp; I found out what the problem was.&amp;nbsp; This code below was not setting the printer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, at the times I tested it where it printed successfully (either in debug mode of the project or when double-clicking the compiled executable file), it was just using the default printer for the currently logged-in user.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked further and found the solution in this article: &lt;A href="https://scn.sap.com/thread/2099449"&gt;https://scn.sap.com/thread/2099449&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing from this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";&lt;/P&gt;&lt;P&gt;crystalReport.PrintToPrinter(1, true, 0, 0); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System.Drawing.Printing.&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Courier New;"&gt;PrinterSettings&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; printersettings = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; System.Drawing.Printing.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Courier New;"&gt;PrinterSettings&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;printersettings.PrinterName = PrinterToUse;&lt;/P&gt;&lt;P&gt;printersettings.Copies = 1;&lt;/P&gt;&lt;P&gt;printersettings.Collate = &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Report.PrintToPrinter(printersettings, &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; System.Drawing.Printing.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Courier New;"&gt;PageSettings&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;(), &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resolved my issue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone else reading this, if using the code above you get the error:&amp;nbsp; "Settings to access printer are not valid."&amp;nbsp; Use this bit of code on the machine where you plan on running the program to get the list of valid printers (if you're making a console application):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;foreach(string myPrinter in System.Drawing.Printing.PrinterSettings.InstalledPrinters){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(myPrinter);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Console.ReadLine();&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 16:31:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/no-printers-are-installed-printtoprinter-problem-from-scheduled-task/qaa-p/11701997#M4376216</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-05-20T16:31:04Z</dc:date>
    </item>
  </channel>
</rss>

