I have a C# program that executes some commands that generates a pdf and print it to a printer. The printer is hosted in a print server, so the way I accessed the printer is through my app config. (\Print Server Name\Printer Name)
<add key="printServerPrinter" value="\\APPS-UATSVR\NPIFBCC54 (HP LaserJet MFP M430)"/>
This program works when I run it on visual studio or even when I release it and run it via its .exe file. It has to run during work hours so I added it to Task Scheduler to start it to check something every minute and print when it found something.
The problem is if the program is started by the Task Scheduler It can't find the printer, it generates a pdf but can't send it to print on the printer since it couldnt find it. This is the error logged on a .txt file.
2023-07-26 06:32:43:751191 Function:Main - Message:The printer named "\\APPS-UATSVR\NPIFBCC54 (HP LaserJet MFP M430)" could not be opened. Error code: 0
If I start it normally there are no problems, as I have said earlier. I searched around the net but couldn't find an answer and i can't seem to debug this problem. I've tried many ways, changed the printer name, changed the port, change the backslash to forward slash but it still wont work.
What seems to be the problem? Thank you very much in advance!