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. When I test the application in debug mode, the reports print to the printer. When I create an executable and put it out on a network drive, I'm able to get the reports to print. 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.
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. The scheduled task is being run under the domain administrator's account. 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.
Does anyone have any idea of how I might resolve this? Here's the offending code below, just in case anyone needs it:
if (isPrintedOut)
{
crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";
crystalReport.PrintToPrinter(1, true, 0, 0);
}